[rspec-users] Rails 3 / RSpec 2 use_transactional_fixtures and after_commit
Michael Guterl
mguterl at gmail.com
Fri Jan 14 11:15:53 EST 2011
We're migrating a Rails 2.3.x application to Rails 3 and RSpec 2.x.
In Rails 2.3.x we were using
https://github.com/freelancing-god/after_commit to provide
after_commit functionality (now provided by Rails 3).
The plugin version of after_commit came with some helpers to make
testing with `use_transactional_fixtures = true` work.
From: https://github.com/freelancing-god/after_commit
"Keep in mind that transactions are finicky at best in tests, and so
there’s a helper module to make after_commit play nicely in your
testing context. You’ll need to add these two lines to your spec/test
helper:"
ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)
ActiveRecord::Base.include_after_savepoint_extensions
Anyone else ran into this?
Best,
Michael Guterl
More information about the rspec-users
mailing list