Parent

Methods

Mocha::Mock

Public Instance Methods

method_missing(symbol, *arguments, &block) click to toggle source

We monkey-patch that method to be able to pass arguments to Expectation#invoke method

# File lib/debugger/test/mocha_extensions.rb, line 29
def method_missing(symbol, *arguments, &block)
  if @responder and not @responder.respond_to?(symbol)
    raise NoMethodError, "undefined method `#{symbol}' for #{self.mocha_inspect} which responds like #{@responder.mocha_inspect}"
  end
  if matching_expectation_allowing_invocation = @expectations.match_allowing_invocation(symbol, *arguments)
    # We change this line - added arguments
    matching_expectation_allowing_invocation.invoke(arguments, &block)
  else
    if (matching_expectation = @expectations.match(symbol, *arguments)) || (!matching_expectation && !@everything_stubbed)
      # We change this line - added arguments
      matching_expectation.invoke(arguments, &block) if matching_expectation
      message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
      require 'mocha/mockery'
      message << Mockery.instance.mocha_inspect
      raise ExpectationError.new(message)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.