Class: WebMock::Matchers::HashArgumentMatcher
- Inherits:
-
Object
- Object
- WebMock::Matchers::HashArgumentMatcher
- Defined in:
- lib/webmock/matchers/hash_argument_matcher.rb
Overview
Base class for Hash matchers github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #==(_actual, &block) ⇒ Object
-
#initialize(expected) ⇒ HashArgumentMatcher
constructor
A new instance of HashArgumentMatcher.
Constructor Details
#initialize(expected) ⇒ HashArgumentMatcher
Returns a new instance of HashArgumentMatcher.
8 9 10 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 8 def initialize(expected) @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort] end |
Class Method Details
.from_rspec_matcher(matcher) ⇒ Object
18 19 20 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 18 def self.from_rspec_matcher(matcher) new(matcher.instance_variable_get(:@expected)) end |
Instance Method Details
#==(_actual, &block) ⇒ Object
12 13 14 15 16 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 12 def ==(_actual, &block) @expected.all?(&block) rescue NoMethodError false end |