Class: Mocha::ParameterMatchers::HasEntries
- Defined in:
- lib/mocha/parameter_matchers/has_entries.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(entries) ⇒ HasEntries
constructor
A new instance of HasEntries.
- #matches?(available_parameters) ⇒ Boolean
- #mocha_inspect ⇒ Object
Methods inherited from Base
#&, #to_matcher, #|
Constructor Details
#initialize(entries) ⇒ HasEntries
Returns a new instance of HasEntries.
27 28 29 |
# File 'lib/mocha/parameter_matchers/has_entries.rb', line 27 def initialize(entries) @entries = entries end |
Instance Method Details
#matches?(available_parameters) ⇒ Boolean
31 32 33 34 35 |
# File 'lib/mocha/parameter_matchers/has_entries.rb', line 31 def matches?(available_parameters) parameter = available_parameters.shift has_entry_matchers = @entries.map { |key, value| HasEntry.new(key, value) } AllOf.new(*has_entry_matchers).matches?([parameter]) end |
#mocha_inspect ⇒ Object
37 38 39 |
# File 'lib/mocha/parameter_matchers/has_entries.rb', line 37 def mocha_inspect "has_entries(#{@entries.mocha_inspect})" end |