[rspec-users] RSpec and PostgreSQL not playing nicely together

Ashley Moran ashley.moran at patchspace.co.uk
Tue Nov 4 17:54:12 EST 2008

On Nov 04, 2008, at 10:15 pm, Mark Wilden wrote:

> I think it's actually simpler to do 'rake db:test:prepare' rather  
> than migrate the test database. Migrations can be a pain when you've  
> only got one database to worry about, much less two. The  
> db:test:prepare task extracts the schema from the development  
> database, drops the test database, then builds it again with the  
> schema script. One reason I like it is that I know for sure that my  
> tests are starting from a known state - empty. The other is that I  
> know for sure that the test db matches the dev db.

Except, this doesn't work if your migrations contain seed data, eg  
lookup tables.  In which case you have to compensate for this in your  
spec setups, which is a risky DRY violation.  It's safer to get your  
test db into shape the same way you get your production one.



More information about the rspec-users mailing list