Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/functions/stdlib/end_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/functions/stdlib/start_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions spec/functions/end_with_spec.rb
Original file line number Diff line number Diff line change
@@ -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\]}
Expand Down
1 change: 1 addition & 0 deletions spec/functions/startswith_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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