module RSpec::Mocks

def allow_message(subject, message, opts={}, &block)

Other tags:
    Example: Defines the implementation of `foo` on `bar`, using the passed block -

Parameters:
  • block () -- an optional implementation for the allowance
  • opts () -- a hash of options, :expected_from is used to set the
  • message () -- a symbol, representing the message that will be
  • subject () -- the subject to which the message will be added
def allow_message(subject, message, opts={}, &block)
  orig_caller = opts.fetch(:expected_from) { caller(1)[0] }
  ::RSpec::Mocks.proxy_for(subject).
    add_stub(orig_caller, message.to_sym, opts, &block)
end