Class: RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher
- Inherits:
-
Object
- Object
- RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher
- Defined in:
- lib/rspec/mocks/argument_matchers.rb
Instance Method Summary collapse
- #==(actual) ⇒ Object
- #description ⇒ Object
-
#initialize(expected) ⇒ HashExcludingMatcher
constructor
A new instance of HashExcludingMatcher.
Constructor Details
#initialize(expected) ⇒ HashExcludingMatcher
Returns a new instance of HashExcludingMatcher.
71 72 73 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 71 def initialize(expected) @expected = expected end |
Instance Method Details
#==(actual) ⇒ Object
75 76 77 78 79 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 75 def ==(actual) @expected.none? {|k,v| actual.has_key?(k) && v == actual[k]} rescue NoMethodError false end |
#description ⇒ Object
81 82 83 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 81 def description "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})" end |