[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

    ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)

Anyone else ran into this?

Michael Guterl

More information about the rspec-users mailing list