Module: RSpec::JsonApi::CompareHash

Extended by:
CompareHash
Included in:
CompareHash
Defined in:
lib/rspec/json_api/compare_hash.rb

Constant Summary collapse

SUPPORTED_OPTIONS =
%i[allow_blank type value min max inclusion regex lambda].freeze

Instance Method Summary collapse

Instance Method Details

#compare(actual, expected) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rspec/json_api/compare_hash.rb', line 10

def compare(actual, expected)
  return false if actual.blank? && expected.present?

  keys = expected.deep_key_paths | actual.deep_key_paths

  compare_key_paths_and_values(keys, actual, expected)
end