module RSpec::Mocks

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

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

Other tags:
    Yield: - an optional implementation for the allowance

Parameters:
  • 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 self.allow_message(subject, message, opts={}, &block)
  space.proxy_for(subject).add_stub(message, opts, &block)
end

def self.configuration

which is core RSpec configuration.
Mocks specific configuration, as distinct from `RSpec.configuration`
def self.configuration
  @configuration ||= Configuration.new
end

def self.error_generator

Other tags:
    Private: -
def self.error_generator
  @error_generator ||= ErrorGenerator.new
end

def self.expect_message(subject, message, opts={}, &block)

Other tags:
    Example: Expect the message `foo` to receive `bar`, then call it -

Other tags:
    Yield: - an optional implementation for the expectation

Parameters:
  • 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 self.expect_message(subject, message, opts={}, &block)
  space.proxy_for(subject).add_message_expectation(message, opts, &block)
end

def self.setup

an test or example begins.
Performs per-test/example setup. This should be called before
def self.setup
  @space_stack << (@space = space.new_scope)
end

def self.teardown

each example, even if an error was raised during the example.
redefined on partial doubles). This _must_ be called after
Cleans up all test double state (including any methods that were
def self.teardown
  space.reset_all
  @space_stack.pop
  @space = @space_stack.last || @root_space
end

def self.verify

test or example. This should be called at the end of an example.
Verifies any message expectations that were set during the
def self.verify
  space.verify_all
end

def self.with_temporary_scope

mock usage in arbitrary places, such as a `before(:all)` hook.
Call the passed block and verify mocks after it has executed. This allows
def self.with_temporary_scope
  setup
  begin
    yield
    verify
  ensure
    teardown
  end
end