Class: Mocha::ParameterMatchers::RespondsWith
Overview
Parameter matcher which matches if actual parameter returns expected result when specified method is invoked.
Instance Method Summary (collapse)
-
- (RespondsWith) initialize(message, result)
constructor
A new instance of RespondsWith.
- - (Boolean) matches?(available_parameters)
- - (Object) mocha_inspect
Methods inherited from Base
#&, #to_matcher, #|
Constructor Details
- (RespondsWith) initialize(message, result)
A new instance of RespondsWith
35 36 37 |
# File 'lib/mocha/parameter_matchers/responds_with.rb', line 35 def initialize(, result) @message, @result = , result end |
Instance Method Details
- (Boolean) matches?(available_parameters)
40 41 42 43 |
# File 'lib/mocha/parameter_matchers/responds_with.rb', line 40 def matches?(available_parameters) parameter = available_parameters.shift parameter.__send__(@message) == @result end |
- (Object) mocha_inspect
46 47 48 |
# File 'lib/mocha/parameter_matchers/responds_with.rb', line 46 def mocha_inspect "responds_with(#{@message.mocha_inspect}, #{@result.mocha_inspect})" end |