Module: RSpec::JsonApi::CompareArray
Instance Method Summary collapse
Instance Method Details
#compare(actual, expected) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rspec/json_api/compare_array.rb', line 8 def compare(actual, expected) if interface?(expected) actual.all? do |actual_elem| return false unless actual_elem.deep_keys == expected[0].deep_keys CompareHash.compare(actual_elem, expected[0]) end else actual.each_with_index.all? do |actual_elem, index| compare_primitive_type_element(actual, expected, actual_elem, index) end end end |