File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 167
167
168
168
case result
169
169
when Array , Hash
170
- Puppet ::Util ::Json . dump ( result , :pretty => true )
170
+ # JSON < 2.8.0 would pretty print empty arrays and hashes with newlines
171
+ # Maintain that behavior for our users for now
172
+ if result . is_a? ( Array ) && result . empty?
173
+ "[\n \n ]"
174
+ elsif result . is_a? ( Hash ) && result . empty?
175
+ "{\n }"
176
+ else
177
+ Puppet ::Util ::Json . dump ( result , :pretty => true )
178
+ end
171
179
else # one of VALID_TYPES above
172
180
result
173
181
end
Original file line number Diff line number Diff line change 91
91
92
92
{
93
93
"type_hash" => [ { 'a' => 2 } , "{\n \" a\" : 2\n }" ] ,
94
+ "type_empty_hash" => [ { } , "{\n }" ] ,
94
95
"type_array" => [ [ ] , "[\n \n ]" ] ,
95
96
"type_string" => [ "str" , "str" ] ,
96
97
"type_int" => [ 1 , "1" ] ,
Original file line number Diff line number Diff line change 77
77
78
78
it "raises if given an invalid URI" do
79
79
resource [ :source ] = 'h;ttp://rubygems.com'
80
- expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI\( is not URI\? \) / )
80
+ expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI \( is not URI\? \) / )
81
81
end
82
82
end
83
83
end
You can’t perform that action at this time.
0 commit comments