method
invoke
1.1.4 -
Show latest stable
- Class:
Spec::Mocks::BaseExpectation
invoke(args, block)public
No documentation available.
# File lib/spec/mocks/message_expectation.rb, line 74
def invoke(args, block)
if @expected_received_count == 0
@actual_received_count += 1
@error_generator.raise_expectation_error @sym, @expected_received_count, @actual_received_count, *args
end
@order_group.handle_order_constraint self
begin
Kernel::raise @exception_to_raise unless @exception_to_raise.nil?
Kernel::throw @symbol_to_throw unless @symbol_to_throw.nil?
if !@method_block.nil?
default_return_val = invoke_method_block(args)
elsif @args_to_yield.size > 0
default_return_val = invoke_with_yield(block)
else
default_return_val = nil
end
if @consecutive
return invoke_consecutive_return_block(args, block)
elsif @return_block
return invoke_return_block(args, block)
else
return default_return_val
end
ensure
@actual_received_count += 1
end
end