method
message_received
1.2.0 -
Show latest stable
- Class:
Spec::Mocks::Proxy
message_received(sym, *args, &block)public
No documentation available.
# File lib/spec/mocks/proxy.rb, line 90
def message_received(sym, *args, &block)
expectation = find_matching_expectation(sym, *args)
stub = find_matching_method_stub(sym, *args)
if (stub && expectation && expectation.called_max_times?) || (stub && !expectation)
if expectation = find_almost_matching_expectation(sym, *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(sym, *args)
expectation.advise(args, block) if null_object? unless expectation.expected_messages_received?
raise_unexpected_message_args_error(expectation, *args) unless (has_negative_expectation?(sym) or null_object?)
else
@target.__send__ :method_missing, sym, *args, &block
end
end