class Mocha::ParameterMatchers::RespondsWith

Parameter matcher which matches if actual parameter returns expected result when specified method is invoked.

Public Class Methods

new(message, result) click to toggle source

@private

# File lib/mocha/parameter_matchers/responds_with.rb, line 32
def initialize(message, result)
  @message = message
  @result = result
end

Public Instance Methods

matches?(available_parameters) click to toggle source

@private

# File lib/mocha/parameter_matchers/responds_with.rb, line 38
def matches?(available_parameters)
  parameter = available_parameters.shift
  @result.to_matcher.matches?([parameter.__send__(@message)])
end
mocha_inspect() click to toggle source

@private

# File lib/mocha/parameter_matchers/responds_with.rb, line 44
def mocha_inspect
  "responds_with(#{@message.mocha_inspect}, #{@result.mocha_inspect})"
end