module RSpec::Mocks::ExampleMethods
def allow_message_expectations_on_nil
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.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)
def mock(*args) declare_double('Mock', *args) end
def stub(*args)
def stub(*args) declare_double('Stub', *args) end