Class: Mocha::ParameterMatchers::AllOf

Inherits:
Base show all
Defined in:
lib/mocha/parameter_matchers/all_of.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(*matchers) ⇒ AllOf

Returns a new instance of AllOf.



25
26
27
# File 'lib/mocha/parameter_matchers/all_of.rb', line 25

def initialize(*matchers)
  @matchers = matchers
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/mocha/parameter_matchers/all_of.rb', line 29

def matches?(available_parameters)
  parameter = available_parameters.shift
  @matchers.all? { |matcher| matcher.to_matcher.matches?([parameter]) }
end

#mocha_inspectObject



34
35
36
# File 'lib/mocha/parameter_matchers/all_of.rb', line 34

def mocha_inspect
  "all_of(#{@matchers.map { |matcher| matcher.mocha_inspect }.join(", ") })"
end