Class: RSpec::Mocks::ArgumentMatchers::HashNotIncludingMatcher
- Inherits:
-
Object
- Object
- RSpec::Mocks::ArgumentMatchers::HashNotIncludingMatcher
- Defined in:
- lib/rspec/mocks/argument_matchers.rb
Instance Method Summary collapse
- #==(actual) ⇒ Object
- #description ⇒ Object
-
#initialize(expected) ⇒ HashNotIncludingMatcher
constructor
A new instance of HashNotIncludingMatcher.
Constructor Details
#initialize(expected) ⇒ HashNotIncludingMatcher
Returns a new instance of HashNotIncludingMatcher.
73 74 75 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 73 def initialize(expected) @expected = expected end |
Instance Method Details
#==(actual) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 77 def ==(actual) @expected.each do | key, value | return false if actual.has_key?(key) && value == actual[key] end true rescue NoMethodError => ex return false end |
#description ⇒ Object
86 87 88 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 86 def description "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})" end |