Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
- Inherits:
-
Object
- Object
- RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
- Defined in:
- lib/rspec/mocks/argument_matchers.rb
Instance Method Summary collapse
- #==(actual) ⇒ Object
- #description ⇒ Object
-
#initialize(expected) ⇒ HashIncludingMatcher
constructor
A new instance of HashIncludingMatcher.
Constructor Details
#initialize(expected) ⇒ HashIncludingMatcher
Returns a new instance of HashIncludingMatcher.
55 56 57 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 55 def initialize(expected) @expected = expected end |
Instance Method Details
#==(actual) ⇒ Object
59 60 61 62 63 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 59 def ==(actual) @expected.all? {|k,v| actual.has_key?(k) && v == actual[k]} rescue NoMethodError false end |
#description ⇒ Object
65 66 67 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 65 def description "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})" end |