File tree 2 files changed +6
-0
lines changed
lib/puppet/parser/functions
spec/unit/puppet/parser/functions
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ module Puppet::Parser::Functions
22
22
accumulator = Hash . new
23
23
# Merge into the accumulator hash
24
24
args . each do |arg |
25
+ next if arg . is_a? String and arg . empty? # empty string is synonym for puppet's undef
25
26
unless arg . is_a? ( Hash )
26
27
raise Puppet ::ParseError , "merge: unexpected argument type #{ arg . class } , only expects hash arguments"
27
28
end
Original file line number Diff line number Diff line change 26
26
describe 'when calling merge on the scope instance' do
27
27
it 'should require all parameters are hashes' do
28
28
expect { new_hash = scope . function_merge ( [ { } , '2' ] ) } . to raise_error ( Puppet ::ParseError , /unexpected argument type String/ )
29
+ expect { new_hash = scope . function_merge ( [ { } , 2 ] ) } . to raise_error ( Puppet ::ParseError , /unexpected argument type Fixnum/ )
30
+ end
31
+
32
+ it 'should accept empty strings as puppet undef' do
33
+ expect { new_hash = scope . function_merge ( [ { } , '' ] ) } . not_to raise_error ( Puppet ::ParseError , /unexpected argument type String/ )
29
34
end
30
35
31
36
it 'should be able to merge two hashes' do
You can’t perform that action at this time.
0 commit comments