Method: RSpec::Mocks::ExampleMethods#instance_double
- Defined in:
- lib/rspec/mocks/example_methods.rb
#instance_double(doubled_class) ⇒ Object #instance_double(doubled_class, name) ⇒ Object #instance_double(doubled_class, stubs) ⇒ Object #instance_double(doubled_class, name, stubs) ⇒ Object
Constructs a test double against a specific class. If the given class name has been loaded, only instance methods defined on the class are allowed to be stubbed. In all other ways it behaves like a double.
56 57 58 59 |
# File 'lib/rspec/mocks/example_methods.rb', line 56 def instance_double(doubled_class, *args) ref = ObjectReference.for(doubled_class) ExampleMethods.(InstanceVerifyingDouble, ref, *args) end |