Method: RSpec::Mocks::ExampleMethods#object_double
- Defined in:
- lib/rspec/mocks/example_methods.rb
#object_double(object_or_name) ⇒ Object #object_double(object_or_name, name) ⇒ Object #object_double(object_or_name, stubs) ⇒ Object #object_double(object_or_name, name, stubs) ⇒ Object
Constructs a test double against a specific object. Only the methods the object responds to are allowed to be stubbed. If a String argument is provided, it is assumed to reference a constant object which is used for verification. In all other ways it behaves like a double.
102 103 104 105 |
# File 'lib/rspec/mocks/example_methods.rb', line 102 def object_double(object_or_name, *args) ref = ObjectReference.for(object_or_name, :allow_direct_object_refs) ExampleMethods.(ObjectVerifyingDouble, ref, *args) end |