def invoke(*args, &block)
if (@expected_received_count == 0 && !@at_least) || ((@exactly || @at_most) && (@actual_received_count == @expected_received_count))
@actual_received_count += 1
@failed_fast = true
@error_generator.raise_expectation_error(@message, @expected_received_count, @actual_received_count, *args)
end
@order_group.handle_order_constraint self
begin
raise_exception unless @exception_to_raise.nil?
Kernel::throw(*@args_to_throw) unless @args_to_throw.empty?
default_return_val = call_with_yield(&block) if !@args_to_yield.empty? || @eval_context
if @consecutive
call_implementation_consecutive(*args, &block)
elsif @implementation
call_implementation(*args, &block)
else
default_return_val
end
ensure
@actual_received_count += 1
end
end