[rspec-users] RSpec, Rails, ObjectDaddy and transactions

Scott Taylor mailing_lists at railsnewbie.com
Fri Sep 26 12:49:32 EDT 2008


On Sep 26, 2008, at 12:38 PM, Tim Glen wrote:

> hey all,
>
> I've started playing around with object daddy and have a question?  
> How do I ensure that anything created during a spec example gets  
> rolled back before the next one?
>
> Without that ability, it starts messing with models that have unique  
> columns on successive runs of my specs.
>
> Oh, and I do have this line in my spec_helper:
> config.use_transactional_fixtures = true
>
> I assume that only does anything to fixtures, specifically

No.  That tells rspec/ test::unit to start a transaction at the start  
of every test case, and issue a rollback when it's over.

That + a transactional database / storage engine should work out of  
the box.

Scott



More information about the rspec-users mailing list