method
double

RSpec latest stable (1.3.1)
-
0 notes -
Class: Spec::Mocks::ExampleMethods
- 1.1.4
- 1.1.12
- 1.2.0
- 1.2.8
- 1.3.0 (0)
- 1.3.1 (0)
- What's this?
double(*args)
public
Shortcut for creating an instance of Spec::Mocks::Mock.
name is used for failure reporting, so you should use the role that the double is playing in the example.
stubs_and_options lets you assign options and stub values at the same time. The only option available is :null_object. Anything else is treated as a stub value.
Examples
thing = double("thing", :a => "A") thing.a == "A" => true person = double("thing", :name => "Joe", :email => "joe@domain.com") person.name => "Joe" person.email => "joe@domain.com"