[rspec-users] (no subject)

Marcus Roberts M.Roberts at NITTYGRITTY.NET
Fri Feb 27 11:14:42 EST 2009

Apologies as this feels like an FAQ, but the only answer I can find refers to a bug in a much earlier version of rspec, and this feels like a common thing to do, so I suspect we're doing something stupid.

The issue seems to be that if we mock a class, that mock carries between specs when running 'rake spec' - the specs pass when run individually.

In one spec, we mock an active record model:

MachineInstance = mock("MachineInstance")

in a spec in another file that runs later, when we access MachineInstance as what should be a regular activerecord class, it's still a mock:

Spec::Mocks::MockExpectationError in 'MachineInstance should create a new instance given valid attributes'
Mock 'MachineInstance' received unexpected message :create! with ({:name=>"value for name", :machine_image_id=>1})

We're running rspec 1.1.12.

Thanks for any pointers.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090227/6381c483/attachment.html>

More information about the rspec-users mailing list