Files

RSpec::Mocks::ExampleMethods

Public Instance Methods

allow_message_expectations_on_nil() click to toggle source

Disables warning messages about expectations being set on nil.

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

# File lib/rspec/mocks/example_methods.rb, line 40
def allow_message_expectations_on_nil
  Proxy.allow_message_expectations_on_nil
end
double(*args) click to toggle source

Creates an instance of RSpec::Mocks::Mock.

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

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

@example

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

card = double("card", :suit => "Spades", :rank => "A")
card.suit  #=> "Spades"
card.rank  #=> "A"
# File lib/rspec/mocks/example_methods.rb, line 21
def double(*args)
  declare_double('Double', *args)
end
mock(*args) click to toggle source

Just like double

# File lib/rspec/mocks/example_methods.rb, line 26
def mock(*args)
  declare_double('Mock', *args)
end
stub(*args) click to toggle source

Just like double

# File lib/rspec/mocks/example_methods.rb, line 31
def stub(*args)
  declare_double('Stub', *args)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.