From the documentation you pointed to:
Mix this in your test context (for example, the base class of the test environment) to use rspec-mocks with your test infrastructure.
Try include in your code:
include RSpec::Mocks::ExampleMethods
Your direct approach failed because the challenge
RSpec::Mocks::ExampleMethods::instance_double(...)
expects a method to be declared as a class method:
def self.instance_double(...)
but it was declared as an instance method:
def instance_double(...)
source share