module RSpec::Mocks::ExampleMethods

def allow_message_expectations_on_nil

prevent false-positives and to catch potential bugs early on.
By default warning messages are issued when expectations are set on nil. This is to

Disables warning messages about expectations being set on nil.
def allow_message_expectations_on_nil
  Proxy.allow_message_expectations_on_nil
end

def declare_double(declared_as, *args)

def declare_double(declared_as, *args)
  args << {} unless Hash === args.last
  args.last[:__declared_as] = declared_as
  RSpec::Mocks::Mock.new(*args)
end

def double(*args)

card.rank => "A"
card.suit => "Spades"
card = double("card", :suit => "Spades", :rank => "A"

book.title => "The RSpec Book"
book = double("book", :title => "The RSpec Book")

== Examples

Use +stubs+ to declare one or more method stubs in one statement.

the mock is playing in the example.
+name+ is used for failure reporting, so you should use the role that

Creates an instance of RSpec::Mocks::Mock.
def double(*args)
  declare_double('Double', *args)
end

def mock(*args)

Just like double, but use double
def mock(*args)
  declare_double('Mock', *args)
end

def stub(*args)

Just like double, but use double
def stub(*args)
  declare_double('Stub', *args)
end