RSpec, Rails, ObjectDaddy and transactions

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

thanks,
tim

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

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

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.

aha! somehow the tables in my mysql db became MyISAM rather than
InnoDB. Not sure how that happened since they’re all innodb on the
production server.

thanks for helping to keep me humble :slight_smile:

tim

On Fri, Sep 26, 2008 at 1:42 PM, Mark W. [email protected] wrote:

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.

#use_transactional_fixtures seems misnamed. Ticket filed.

I agree it’s the wrong name, but it’s the one Rails uses (RSpec just
delegates over to Rails).

David

On Fri, Sep 26, 2008 at 9:49 AM, Scott T.
<[email protected]

wrote:

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.

#use_transactional_fixtures seems misnamed. Ticket filed.

///ark