class WebMock::Matchers::HashArgumentMatcher

Base class for Hash matchers github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb

Public Class Methods

from_rspec_matcher(matcher) click to toggle source
# File lib/webmock/matchers/hash_argument_matcher.rb, line 16
def self.from_rspec_matcher(matcher)
  new(matcher.instance_variable_get(:@expected))
end
new(expected) click to toggle source
# File lib/webmock/matchers/hash_argument_matcher.rb, line 6
def initialize(expected)
  @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort]
end

Public Instance Methods

==(_actual, &block) click to toggle source
# File lib/webmock/matchers/hash_argument_matcher.rb, line 10
def ==(_actual, &block)
  @expected.all?(&block)
rescue NoMethodError
  false
end