[Rspec-users] Should fixtures be transactional?

aslak hellesoy aslak.hellesoy at gmail.com
Tue Oct 17 13:23:48 EDT 2006


On 10/17/06, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> I started using the new Model.should_have(1).records expectation in
> rspec_on_rails, and quickly realized that my fixtures were remaining
> loaded, even in contexts that didn't use them.  Bug or feature?
>

Looks like a bug.

I reproduced this by standing in rspec_on_rails and running:

spec spec/models/person_spec.rb -s "A new Person" ; echo "select *
from people;" | sqlite3 db/test.db

It prints out the following at the end:

1|Lachie

I put some debug statements in AR's fixtures.rb#teardown_with_fixtures
right before ActiveRecord::Base.connection.rollback_db_transaction.
And the rollback is definitely being executed.

So I'm inclined to think this is a Rails bug with sqlite3.
I haven't tried with Test::Unit to see if it behaves the same way.

What Rails version and what database are you using?

Aslak

> Jay Levitt
>
> _______________________________________________
> Rspec-users mailing list
> Rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the Rspec-users mailing list