method

double

Importance_1
1.3.1 - Show latest stable - 0 notes - Class: Spec::Mocks::ExampleMethods
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"
Show source
Register or log in to add new notes.