Method: RSpec::Mocks::ExampleMethods#spy

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

#spyDouble #spy(name) ⇒ Double #spy(stubs) ⇒ Double #spy(name, stubs) ⇒ Double

Constructs a test double that is optimized for use with have_received. With a normal double one has to stub methods in order to be able to spy them. A spy automatically spies on all methods.



120
121
122
# File 'lib/rspec/mocks/example_methods.rb', line 120

def spy(*args)
  double(*args).as_null_object
end