summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTP Honey <tphoney@users.noreply.github.com>2017-09-25 09:55:20 +0100
committerGitHub <noreply@github.com>2017-09-25 09:55:20 +0100
commitff6345584eabe1b7ad8836e7c9333ee4519b551a (patch)
tree7cb55daa08f8ebcb7cfc300187859594ec0dda1e
parente66f7aa1ba49fef4296d977b471a1def38c1df5c (diff)
parent2220810c4ad8ea22b2cdc58bc0b9c7392a388b01 (diff)
Merge pull request #777 from alexjfisher/fix_test_filenames
Fix filenames of two function spec tests
-rw-r--r--lib/puppet/functions/length.rb2
-rwxr-xr-xspec/functions/is_function_available_spec.rb (renamed from spec/functions/is_function_available.rb)0
-rwxr-xr-xspec/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