class RSpec::Mocks::Proxy
def message_received(message, *args, &block)
- Private: -
def message_received(message, *args, &block) record_message_received message, *args, &block expectation = find_matching_expectation(message, *args) stub = find_matching_method_stub(message, *args) if (stub && expectation && expectation.called_max_times?) || (stub && !expectation) expectation.increase_actual_received_count! if expectation && expectation.actual_received_count_matters? if expectation = find_almost_matching_expectation(message, *args) expectation.advise(*args) unless expectation.expected_messages_received? end stub.invoke(nil, *args, &block) elsif expectation expectation.invoke(stub, *args, &block) elsif expectation = find_almost_matching_expectation(message, *args) expectation.advise(*args) if null_object? unless expectation.expected_messages_received? raise_unexpected_message_args_error(expectation, *args) unless (has_negative_expectation?(message) or null_object?) elsif stub = find_almost_matching_stub(message, *args) stub.advise(*args) raise_missing_default_stub_error(stub, *args) elsif @object.is_a?(Class) @object.superclass.__send__(message, *args, &block) else @object.__send__(:method_missing, message, *args, &block) end end