Method: RSpec::Mocks::ExampleMethods#double

Defined in:
lib/rspec/mocks/example_methods.rb

#doubleDouble #double(name) ⇒ Double #double(stubs) ⇒ Double #double(name, stubs) ⇒ Double

Constructs an instance of RSpec::Mocks::Double configured with an optional name, used for reporting in failure messages, and an optional hash of message/return-value pairs.

Examples:

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"


34
35
36
# File 'lib/rspec/mocks/example_methods.rb', line 34

def double(*args)
  ExampleMethods.declare_double(Double, *args)
end