Class: RSpec::Mocks::ArgumentMatchers::BaseHashMatcher Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher, RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
|
|
Inherits: | Object |
Defined in: | rspec-mocks/lib/rspec/mocks/argument_matchers.rb |
Class Method Summary
- .new(expected) ⇒ BaseHashMatcher constructor Internal use only
Instance Method Summary
- #===(predicate, actual) Internal use only
- #description(name) Internal use only
- #formatted_expected_hash private Internal use only
Instance Method Details
#===(predicate, actual)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/argument_matchers.rb', line 193
def ===(predicate, actual) @expected.__send__(predicate) do |k, v| actual.key?(k) && Support::FuzzyMatcher.values_match?(v, actual[k]) end rescue NoMethodError false end
#description(name)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/argument_matchers.rb', line 201
def description(name) "#{name}(#{formatted_expected_hash.inspect.sub(/^\{/, "").sub(/\}$/, "")})" end
#formatted_expected_hash (private)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/argument_matchers.rb', line 207
def formatted_expected_hash Hash[ @expected.map do |k, v| k = RSpec::Support.rspec_description_for_object(k) v = RSpec::Support.rspec_description_for_object(v) [k, v] end ] end