class Mocha::Invocation
def argument_description
def argument_description signature = arguments.mocha_inspect signature = signature.gsub(/^\[|\]$/, '') "(#{signature})" end
def arguments
def arguments @arguments.dup end
def call(yield_parameters = YieldParameters.new, return_values = ReturnValues.new)
def call(yield_parameters = YieldParameters.new, return_values = ReturnValues.new) yield_parameters.next_invocation.each do |yield_args| @yields << ParametersMatcher.new(yield_args) raise LocalJumpError unless @block @block.call(*yield_args) end return_values.next(self) end
def call_description
def call_description description = "#{@mock.mocha_inspect}.#{@method_name}#{argument_description}" description << ' { ... }' unless @block.nil? description end
def full_description
def full_description "\n - #{call_description} #{result_description}" end
def initialize(mock, method_name, arguments = [], block = nil)
def initialize(mock, method_name, arguments = [], block = nil) @mock = mock @method_name = method_name @arguments = arguments @block = block @yields = [] @result = nil end
def raised(exception)
def raised(exception) @result = RaisedException.new(exception) end
def result_description
def result_description desc = "# => #{@result.mocha_inspect}" desc << " after yielding #{@yields.map(&:mocha_inspect).join(', then ')}" if @yields.any? desc end
def returned(value)
def returned(value) @result = value end
def short_call_description
def short_call_description "#{@method_name}(#{@arguments.join(', ')})" end
def threw(tag, value)
def threw(tag, value) @result = ThrownObject.new(tag, value) end