For testing, I use:
self.use_transactional_fixtures = true
This should cause a ROLLBACK for each test case. If I run a single
file, foo_controller_test.rb, it works as expected. I see BEGIN and
ROLLBACK 8 times in the log files. But if I run:
I get 3 COMMITs, 196 BEGINS and 193 ROLLBACKs. The code in fixtures.rb
that deals with this is :
def teardown_with_fixtures return unless defined?(ActiveRecord::Base) && !
# Rollback changes if a transaction is active.
if use_transactional_fixtures? &&
Thread.current[‘open_transactions’] != 0
Thread.current[‘open_transactions’] = 0
and I found that Thread.current[‘open_transactions’] equals zero in
anyone else encounter this or see something I’m missing? I guess I’ll
need to try to follow the increment/decrement of open_transactions.