Class: Mocha::ParameterMatchers::HasEntries

Inherits:
Base
  • Object
show all
Defined in:
lib/mocha/parameter_matchers/has_entries.rb

Overview

:nodoc:

Instance Method Summary collapse

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

Returns:

  • (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_inspectObject



37
38
39
# File 'lib/mocha/parameter_matchers/has_entries.rb', line 37

def mocha_inspect
  "has_entries(#{@entries.mocha_inspect})"
end