Testing a gem outside the rails framework


#1

I’m writing an acts_as_something gem for ActiveRecord. I want to test it
only on the ActiveRecord part of the framework. Therefore I’m not
loading the entire rails framework, only ActiveRecord. That’s all fine
but I need to wrap each test in a transaction which gets rolled back in
the teardown for each test. ActiveSupport is supposed to do this if you
set the undocumented use_transactional_fixtures = true except that
doesn’t appear to be working in 2.3.3 and in any case I don’t want to
load ActiveSupport.

Really I want to use Test::Unit along with Shoulda. I can get the
transaction to start in Test::Unit::TestCase setup, but how can I get it
to rollback in teardown? There’s no rollback method to complement
ActiveRecord::Base.transaction

Comments please

John S.