I have a test case like this:
describe WorkCardsController do
it "something" do
work_card = instance_double(WorkCard, {:started?=>true} )
#some more code
end
end
When I run RSpec, I get an error:
undefined method 'instance_double' for #<Rspec::Core::ExampleGroup::Nested_1::Nested_8::Nested_3:0x007f0788b98778>
According to http://rubydoc.info/github/rspec/rspec-mocks/RSpec/Mocks/ExampleMethods this method exists. So I tried to access it directly by:
describe WorkCardsController do
it "something" do
work_card = RSpec::Mocks::ExampleMethods::instance_double(WorkCard, {:started?=>true} )
#some more code
end
end
And then I got a very surprising error:
undefined method 'instance_double' for Rspec::Mocks::ExampleMEthods:Module
which is contrary to the documentation I linked above.
What am I missing?