Module RSpec::Mocks::TestDouble
In: lib/rspec/mocks/test_double.rb

Implements the methods needed for a pure test double. RSpec::Mocks::Mock includes this module, and it is provided for cases where you want a pure test double without subclassing RSpec::Mocks::Mock.

Methods

Public Class methods

Extends the TestDouble module onto the given object and initializes it as a test double.

@example

  module = Module.new
  RSpec::Mocks::TestDouble.extend_onto(module, "MyMixin", :foo => "bar")
  module.foo  #=> "bar"

Creates a new test double with a `name` (that will be used in error messages only)

Public Instance methods

This allows for comparing the mock to other objects that proxy such as ActiveRecords belongs_to proxy objects. By making the other object run the comparison, we‘re sure the call gets delegated to the proxy target.

Tells the object to respond to all messages. If specific stub values are declared, they‘ll work as expected. If not, the receiver is returned.

@private

Returns true if this object has received `as_null_object`

@private

to_str()

Alias for to_s

[Validate]