diff --git a/lib/puppet/functions/stdlib/end_with.rb b/lib/puppet/functions/stdlib/end_with.rb index 2be98e6a6..fc83f70aa 100644 --- a/lib/puppet/functions/stdlib/end_with.rb +++ b/lib/puppet/functions/stdlib/end_with.rb @@ -10,7 +10,7 @@ # 'foobar'.stdlib::end_with(['foo', 'baz']) => false # @return [Boolean] True or False dispatch :end_with do - param 'String[1]', :test_string + param 'String', :test_string param 'Variant[String[1],Array[String[1], 1]]', :suffixes return_type 'Boolean' end diff --git a/lib/puppet/functions/stdlib/start_with.rb b/lib/puppet/functions/stdlib/start_with.rb index 294c72a54..28f01bbd5 100644 --- a/lib/puppet/functions/stdlib/start_with.rb +++ b/lib/puppet/functions/stdlib/start_with.rb @@ -10,7 +10,7 @@ # 'foObar'.stdlib::start_with(['bar', 'baz']) => false # @return [Boolean] True or False dispatch :start_with do - param 'String[1]', :test_string + param 'String', :test_string param 'Variant[String[1],Array[String[1], 1]]', :prefixes return_type 'Boolean' end diff --git a/spec/functions/end_with_spec.rb b/spec/functions/end_with_spec.rb index a9b95eca8..5c1e8a974 100644 --- a/spec/functions/end_with_spec.rb +++ b/spec/functions/end_with_spec.rb @@ -1,14 +1,10 @@ require 'spec_helper' describe 'stdlib::end_with' do + it { is_expected.to run.with_params('', 'bar').and_return(false) } it { is_expected.to run.with_params('foobar', 'bar').and_return(true) } it { is_expected.to run.with_params('foobar', 'foo').and_return(false) } it { is_expected.to run.with_params('foobar', ['foo', 'baz']).and_return(false) } - it do - is_expected.to run.with_params('', 'foo').and_raise_error( - ArgumentError, %r{'stdlib::end_with' parameter 'test_string' expects a String\[1\] value} - ) - end it do is_expected.to run.with_params('foobar', '').and_raise_error( ArgumentError, %r{'stdlib::end_with' parameter 'suffixes' expects a value of type String\[1\] or Array\[String\[1\], 1\]} diff --git a/spec/functions/startswith_spec.rb b/spec/functions/startswith_spec.rb index 382088372..a25919230 100644 --- a/spec/functions/startswith_spec.rb +++ b/spec/functions/startswith_spec.rb @@ -5,6 +5,7 @@ it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{expects 2 arguments, got none}i) } it { is_expected.to run.with_params('').and_raise_error(ArgumentError, %r{expects 2 arguments, got 1}) } + it { is_expected.to run.with_params('', 'foo').and_return(false) } it { is_expected.to run.with_params('foobar', 'foo').and_return(true) } it { is_expected.to run.with_params('foObar', ['bar', 'baz']).and_return(false) } end