module RSpec::Mocks
def self.configuration
def self.configuration @configuration ||= Configuration.new end
def allow_message(subject, message, opts={}, &block)
- 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
def any_instance_recorder_for(klass)
def any_instance_recorder_for(klass) space.any_instance_recorder_for(klass) end
def expect_message(subject, message, opts={}, &block)
- Example: Expect the message `foo` to receive `bar`, then call it -
Parameters:
-
block
() -- an optional implementation for the expectation
-
opts
() -- a hash of options, :expected_from is used to set the
-
message
() -- a symbol, representing the message that will be
-
subject
() -- the subject on which the message will be expected
def expect_message(subject, message, opts={}, &block) orig_caller = opts.fetch(:expected_from) { caller(1)[0] } ::RSpec::Mocks.proxy_for(subject). add_message_expectation(orig_caller, message.to_sym, opts, &block) end
def method_handle_for(object, method_name)
- Api: - private
def method_handle_for(object, method_name) if ::Kernel === object KERNEL_METHOD_METHOD.bind(object).call(method_name) else object.method(method_name) end end
def proxy_for(object)
def proxy_for(object) space.proxy_for(object) end
def setup(host)
def setup(host) (class << host; self; end).class_eval do include RSpec::Mocks::ExampleMethods end self.space ||= RSpec::Mocks::Space.new end
def teardown
def teardown space.reset_all end
def verify
def verify space.verify_all end