Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
- Inherits:
-
Object
- Object
- RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
- Defined in:
- lib/rspec/mocks/argument_matchers.rb
Instance Method Summary (collapse)
- - (Object) ==(actual)
- - (Object) description
-
- (HashIncludingMatcher) initialize(expected)
constructor
A new instance of HashIncludingMatcher.
Constructor Details
- (HashIncludingMatcher) initialize(expected)
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
- (Object) ==(actual)
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 |
- (Object) description
65 66 67 |
# File 'lib/rspec/mocks/argument_matchers.rb', line 65 def description "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})" end |