|
22 | 22 |
|
23 | 23 | describe 'when calling merge from puppet' do |
24 | 24 | it "should not compile when no arguments are passed" do |
| 25 | + pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ |
25 | 26 | Puppet[:code] = '$rval = merge()' |
26 | 27 | expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/) |
27 | 28 | end |
| 29 | + |
28 | 30 | it "should not compile when 1 argument is passed" do |
| 31 | + pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./ |
29 | 32 | Puppet[:code] = "$my_hash={'one' => 1}\n$rval = merge($my_hash)" |
30 | 33 | expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/) |
31 | 34 | end |
32 | 35 | end |
| 36 | + |
33 | 37 | describe 'when calling merge on the scope instance' do |
34 | 38 | it 'should require all parameters are hashes' do |
35 | 39 | expect { new_hash = scope.function_merge([{}, '2'])}.should raise_error(Puppet::ParseError, /unexpected argument type String/) |
36 | 40 |
|
37 | 41 | end |
| 42 | + |
38 | 43 | it 'should be able to merge two hashes' do |
39 | 44 | new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}]) |
40 | 45 | new_hash['one'].should == '1' |
41 | 46 | new_hash['two'].should == '2' |
42 | 47 | new_hash['three'].should == '2' |
43 | 48 | end |
| 49 | + |
44 | 50 | it 'should merge multiple hashes' do |
45 | 51 | hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}]) |
46 | 52 | hash['one'].should == '3' |
47 | 53 | end |
| 54 | + |
48 | 55 | it 'should accept empty hashes' do |
49 | 56 | scope.function_merge([{},{},{}]).should == {} |
50 | 57 | end |
51 | | - |
52 | 58 | end |
53 | | - |
54 | 59 | end |
0 commit comments