Class: Mocha::ParameterMatchers::HasValue
- Defined in:
- lib/mocha/parameter_matchers/has_value.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(value) ⇒ HasValue
constructor
A new instance of HasValue.
- #matches?(available_parameters) ⇒ Boolean
- #mocha_inspect ⇒ Object
Methods inherited from Base
#&, #to_matcher, #|
Constructor Details
#initialize(value) ⇒ HasValue
Returns a new instance of HasValue.
25 26 27 |
# File 'lib/mocha/parameter_matchers/has_value.rb', line 25 def initialize(value) @value = value end |
Instance Method Details
#matches?(available_parameters) ⇒ Boolean
29 30 31 32 33 |
# File 'lib/mocha/parameter_matchers/has_value.rb', line 29 def matches?(available_parameters) parameter = available_parameters.shift return false unless parameter.respond_to?(:values) parameter.values.any? { |value| @value.to_matcher.matches?([value]) } end |
#mocha_inspect ⇒ Object
35 36 37 |
# File 'lib/mocha/parameter_matchers/has_value.rb', line 35 def mocha_inspect "has_value(#{@value.mocha_inspect})" end |