#96: rails tests not getting rolled back
Solved!
There are a number of reasons this might happen: you have a test, it runs fine individually, but when you run rake test or rake test:units, it fails. This might be because one test is writing to the db and those changes aren't getting rolled back.
ActiveRecord::Base#establish_connection
- kueda on May 19, 2010, 11:25 PM UTC
If you're testing code that switches db connections, this will break the transaction that wraps your test. That test might pass, but it will leave data in the db that might break subsequent tests.