diff options
author | Alexander Fisher <alex@linfratech.co.uk> | 2017-05-14 14:16:28 +0100 |
---|---|---|
committer | Alexander Fisher <alex@linfratech.co.uk> | 2017-07-11 10:32:57 +0100 |
commit | 2220810c4ad8ea22b2cdc58bc0b9c7392a388b01 (patch) | |
tree | f975f6cf1ee912fba196628750baccbeebc4fc22 | |
parent | 5a17bf1c338c74bd6c8dbacc9a05b4cd501ecc23 (diff) |
Fix filenames of two function spec tests
The tests weren't being run. Total tests increase from 2742 to 2769.
Also fix 'when using a class extending String' test.
It had been failing with...
```
RuntimeError:
can't modify frozen AlsoString
```
-rw-r--r-- | lib/puppet/functions/length.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_function_available_spec.rb (renamed from spec/functions/is_function_available.rb) | 0 | ||||
-rwxr-xr-x | spec/functions/length_spec.rb (renamed from spec/functions/length.rb) | 6 |
3 files changed, 2 insertions, 6 deletions
diff --git a/lib/puppet/functions/length.rb b/lib/puppet/functions/length.rb index 86e735c..5ebd455 100644 --- a/lib/puppet/functions/length.rb +++ b/lib/puppet/functions/length.rb @@ -3,7 +3,7 @@ Puppet::Functions.create_function(:length) do dispatch :length do param 'Variant[String,Array,Hash]', :value end - def length(value) + def length(value) if value.is_a?(String) result = value.length elsif value.is_a?(Array) || value.is_a?(Hash) diff --git a/spec/functions/is_function_available.rb b/spec/functions/is_function_available_spec.rb index 44f08c0..44f08c0 100755 --- a/spec/functions/is_function_available.rb +++ b/spec/functions/is_function_available_spec.rb diff --git a/spec/functions/length.rb b/spec/functions/length_spec.rb index d1ab003..487cf21 100755 --- a/spec/functions/length.rb +++ b/spec/functions/length_spec.rb @@ -26,10 +26,6 @@ describe 'length' do it { is_expected.to run.with_params('āβćđ').and_return(4) } context 'when using a class extending String' do - it 'should call its size method' do - value = AlsoString.new('asdfghjkl') - value.expects(:length).returns('foo') - expect(subject).to run.with_params(value).and_return('foo') - end + it { is_expected.to run.with_params(AlsoString.new('asdfghjkl')).and_return(9) } end end |