features/step_definitions/json_steps.rb in berkshelf-2.0.18 vs features/step_definitions/json_steps.rb in berkshelf-3.0.0.beta1

- old
+ new

@@ -3,10 +3,12 @@ self.keys.sort(&block).reduce({}) do |seed, key| seed[key] = self[key] if seed[key].is_a?(Hash) seed[key] = seed[key].sort_by_key(&block) elsif seed[key].is_a?(Array) - seed[key] = seed[key].map { |i| i.sort_by_key(&block) } + seed[key] = seed[key].map do |i| + i.respond_to?(:sort_by_key) ? i.sort_by_key(&block) : i + end end seed end end end