diff options
author | Travis Fields <travis@puppetlabs.com> | 2015-01-13 17:16:10 -0800 |
---|---|---|
committer | Travis Fields <travis@puppetlabs.com> | 2015-01-13 17:16:10 -0800 |
commit | ac3e51bac57ecc4b29965b5df5f10c2934b61cd0 (patch) | |
tree | 71413b757c0e0ec4d21727386979354e50099fdc /spec/functions/concat_spec.rb | |
parent | 80f09623b63cf6946b5913b629911e2c49b5d1dd (diff) | |
parent | 8db1f2e2f082cd688fa061fd6840cd0cea747232 (diff) |
Merge branch 'master' into 4.5.x
Diffstat (limited to 'spec/functions/concat_spec.rb')
-rwxr-xr-x | spec/functions/concat_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb index 49cb2ad..49fa6bb 100755 --- a/spec/functions/concat_spec.rb +++ b/spec/functions/concat_spec.rb @@ -4,14 +4,19 @@ require 'spec_helper' describe "the concat function" do let(:scope) { PuppetlabsSpec::PuppetInternals.scope } - it "should raise a ParseError if the client does not provide two arguments" do + it "should raise a ParseError if the client does not provide at least two arguments" do expect { scope.function_concat([]) }.to(raise_error(Puppet::ParseError)) + expect { scope.function_concat([[1]]) }.to(raise_error(Puppet::ParseError)) end it "should raise a ParseError if the first parameter is not an array" do expect { scope.function_concat([1, []])}.to(raise_error(Puppet::ParseError)) end + it "should not raise a ParseError if the client provides more than two arguments" do + expect { scope.function_concat([[1],[2],[3]]) }.not_to raise_error + end + it "should be able to concat an array" do result = scope.function_concat([['1','2','3'],['4','5','6']]) expect(result).to(eq(['1','2','3','4','5','6'])) @@ -32,4 +37,14 @@ describe "the concat function" do result = scope.function_concat([array_original,['4','5','6']]) array_original.should(eq(['1','2','3'])) end + + it "should be able to concat multiple arrays" do + result = scope.function_concat([['1','2','3'],['4','5','6'],['7','8','9']]) + expect(result).to(eq(['1','2','3','4','5','6','7','8','9'])) + end + + it "should be able to concat mix of primitives and arrays to a final array" do + result = scope.function_concat([['1','2','3'],'4',['5','6','7']]) + expect(result).to(eq(['1','2','3','4','5','6','7'])) + end end |