I recently noticed my test database is not being cleaned up after my tests run if my tests subclass Test::Unit::TestCase. If my tests subclass ActiveSupport::TestCase, everything is cleaned up properly.
Can anyone explain why, and/or provide an explanation of using one versus the other?
I am using shoulda and factory_girl.
Thanks.
If you take a look at the code, you’ll see
ActiveSupport::TestCasehas a lot of of setup and utility functions for testing Rails. Older versions of Rails used to useTest::Unit::TestCasewith a lot of mixins, but moved to subclassing a while ago.If you’re testing a Rails app, you should subclass
ActiveSupport::TestCaseorActionController:TestCasefor controllers. The generators will do this automatically, so you should not have to think about it most of the time.