Class: DeepDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/matic/testing/vcr_json_api/json_body_matcher.rb

Class Method Summary collapse

Class Method Details

.call(a, b) ⇒ Object

rubocop:disable all



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/matic/testing/vcr_json_api/json_body_matcher.rb', line 2

def self.call(a, b) # rubocop:disable all
  (a.keys | b.keys).each_with_object({}) do |k, diff|
    if a[k] != b[k]
      diff[k] = if a[k].is_a?(Hash) && b[k].is_a?(Hash)
                  self.(a[k], b[k])
                else
                  { actual: a[k], expected: b[k] }
                end
    end
    diff
  end
end