|
4 | 4 | describe "the concat function" do |
5 | 5 | let(:scope) { PuppetlabsSpec::PuppetInternals.scope } |
6 | 6 |
|
7 | | - it "should raise a ParseError if there is less than 1 arguments" do |
8 | | - lambda { scope.function_concat([]) }.should( raise_error(Puppet::ParseError)) |
| 7 | + it "should raise a ParseError if the client does not provide two arguments" do |
| 8 | + lambda { scope.function_concat([]) }.should(raise_error(Puppet::ParseError)) |
| 9 | + end |
| 10 | + |
| 11 | + it "should raise a ParseError if the first parameter is not an array" do |
| 12 | + lambda { scope.function_concat([1, []])}.should(raise_error(Puppet::ParseError)) |
9 | 13 | end |
10 | 14 |
|
11 | 15 | it "should be able to concat an array" do |
12 | 16 | result = scope.function_concat([['1','2','3'],['4','5','6']]) |
13 | 17 | result.should(eq(['1','2','3','4','5','6'])) |
14 | 18 | end |
| 19 | + |
| 20 | + it "should be able to concat a primitive to an array" do |
| 21 | + result = scope.function_concat([['1','2','3'],'4']) |
| 22 | + result.should(eq(['1','2','3','4'])) |
| 23 | + end |
| 24 | + |
| 25 | + it "should not accidentally flatten nested arrays" do |
| 26 | + result = scope.function_concat([['1','2','3'],[['4','5'],'6']]) |
| 27 | + result.should(eq(['1','2','3',['4','5'],'6'])) |
| 28 | + end |
| 29 | + |
15 | 30 | end |
0 commit comments