[rspec-users] Specifying certain tables NOT to be cleared each example?

Andrew Selder aselder at mac.com
Thu May 22 09:27:34 EDT 2008


I am using rake db:migrate RAILS_ENV=test.

The values I'm inserting into the tables using migrations are gone by  
the time the tests run.


On May 22, 2008, at 7:07 AM, Ashley Moran wrote:

> On 22 May 2008, at 03:49, Andrew Selder wrote:
>> It would be wonderful if there was some option to specify tables  
>> that behave like this, that should be loaded at the beginning of  
>> the test run, and (optionally) trashed at the end of the run. Or  
>> even better, specify that the test script shouldn't touch (build or  
>> teardown) these tables at all, and let their migrated state remain.
> Like Scott said, this shouldn't be a problem.  Are you creating your  
> test DB like this?
>  rake db:test:clone
> If so, try this:
>  rake db:migrate RAILS_ENV=test
> It will create a test database that is identical to a new production  
> database, instead of an approximation.  I have no idea why the Rails  
> team decided would be better to test against an incomplete database,  
> but I always use migrate now, instead of clone.
> Ashley
> -- 
> http://www.patchspace.co.uk/
> http://aviewfromafar.net/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list