On May 30, 2006, at 2:33 PM, cremes.devlist / mac.com wrote:

> I'm working on a program that manipulates and stores a lot of data  
> in a database via ActiveRecord. I'm having a heck of a time trying  
> to write unit and functional tests for this program because I don't  
> have a reasonable way to reload the test db. I'd like to use the  
> fixtures facility from Rails but so far I've failed at ripping it  
> out and moving it to a non-Rails environment.
>
> (BTW, I'm using the MockFS gem to test the filesystem portions of  
> the code and I have to say it is working *brilliantly*. Many thanks  
> to the author!)
>
> Anyone have experience with this type of work? Care to share any  
> tips on getting this to work?
>
> Thanks very much.
>
> cr
>

Hey-

	I had to do the same thing to test an activerecord extension plugin  
outside of  rails. You can feel free to steal the test harness from  
my plugin:

http://opensvn.csie.org/ezra/rails/ez_where_two/test/test_helper.rb

	Thats the test_helper that loads activerecord with a database.yml  
and then defines some models and loads the fixtures as well. Have a  
look around the plugin for the way I made this happen.

-Ezra