lib/webmock/matchers/hash_including_matcher.rb in webmock-3.0.1 vs lib/webmock/matchers/hash_including_matcher.rb in webmock-3.1.0

- old
+ new

@@ -1,36 +1,17 @@ module WebMock module Matchers - #this is a based on RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher - #https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb - class HashIncludingMatcher - def initialize(expected) - @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort] - end - + # this is a based on RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher + # https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb + class HashIncludingMatcher < HashArgumentMatcher def ==(actual) - @expected.all? {|k,v| actual.has_key?(k) && v === actual[k]} + super { |key, value| actual.key?(key) && value === actual[key] } rescue NoMethodError false end def inspect "hash_including(#{@expected.inspect})" end - - def self.from_rspec_matcher(matcher) - new(matcher.instance_variable_get(:@expected)) - end end - - #this is a based on RSpec::Mocks::ArgumentMatchers::AnyArgMatcher - class AnyArgMatcher - def initialize(ignore) - end - - def ==(other) - true - end - end - end end