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

Ashley Moran ashley.moran at patchspace.co.uk
Thu May 22 07:07:28 EDT 2008

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.



More information about the rspec-users mailing list