class Object
Public Instance Methods
arrays_match?(actual, expected)
click to toggle source
# File lib/rspec_deep_ignore_order_matcher.rb, line 25 def arrays_match?(actual, expected) exp = expected.clone actual.each do |a| index = exp.find_index { |e| match? a, e } return false if index.nil? exp.delete_at(index) end exp.empty? end
hashes_match?(actual, expected)
click to toggle source
# File lib/rspec_deep_ignore_order_matcher.rb, line 35 def hashes_match?(actual, expected) return false unless actual.keys.sort == expected.keys.sort actual.each { |key, value| return false unless match? value, expected[key] } true end
match?(actual, expected)
click to toggle source
# File lib/rspec_deep_ignore_order_matcher.rb, line 19 def match?(actual, expected) return arrays_match?(actual, expected) if expected.is_a?(Array) && actual.is_a?(Array) return hashes_match?(actual, expected) if expected.is_a?(Hash) && actual.is_a?(Hash) expected == actual end