bmabey/database_cleaner — Issue #74: Error in ActiveRecord's decrement_open_transactions call, mysql and Rails 3
Author: bantic
Created: 2011-10-12 21:12:55+00:00
State: open

This is with a Rails 3.0.10 project using mysql (I'm also using mongo_mapper and redis in the same project, but not trying to use database_cleaner with them).

I upgraded from DatabaseCleaner v 0.5.2 to v 0.6.7 and now when I run tests I get a nil object error.

The error is from activerecord's "decrement_open_transactions" method here:
https://github.com/rails/rails/blob/3-0-10/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L175

The @open_transaction instance variable is undefined for some reason.

Is this a known issue? I downgraded to 0.5.2 and it works, so I'm going to stick with that for the time being.

My spec_helper rspec configuration block includes this:

```ruby
config.use_transactional_fixtures = true

DatabaseCleaner.strategy = :transaction

config.before :each do
DatabaseCleaner.start
end

config.after :each do
DatabaseCleaner.clean
end
```