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