rspec-support/upstream/lib/rspec/support/fuzzy_matcher.rb in opal-rspec-0.8.0 vs rspec-support/upstream/lib/rspec/support/fuzzy_matcher.rb in opal-rspec-1.0.0.alpha1

- old
+ new

@@ -4,16 +4,16 @@ # Understands array/hash nesting. Uses `===` or `==` to # perform the matching. module FuzzyMatcher # @api private def self.values_match?(expected, actual) - if Array === expected && Enumerable === actual && !(Struct === actual) + if Hash === actual + return hashes_match?(expected, actual) if Hash === expected + elsif Array === expected && Enumerable === actual && !(Struct === actual) return arrays_match?(expected, actual.to_a) - elsif Hash === expected && Hash === actual - return hashes_match?(expected, actual) - elsif actual == expected - return true end + + return true if expected == actual begin expected === actual rescue ArgumentError # Some objects, like 0-arg lambdas on 1.9+, raise