# Testing a gem outside the rails framework

**URL:** <https://www.ruby-forum.com/t/testing-a-gem-outside-the-rails-framework/165225>\
**Category:** Rails\
**Created:** [April 10, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/testing-a-gem-outside-the-rails-framework/165225 "2009-04-10T12:35:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [April 10, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/testing-a-gem-outside-the-rails-framework/165225/1 "2009-04-10T12:35:54Z")

</div>

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.
