views:

65

answers:

1

Hi,

I'm developing a Rails application with Rspec for unit testing.

Weeks ago, Rspec used to migrate the database to the last version automatically when executing 'rake spec', but now it doesn't do it automatically, I have to implement everything for myself.

This happens in test environment, because my development data doesn't desappear.

Is my fault? I didn't change anything, I think :)

Thanks in advance.

A: 

Typically what I do is use an alias command that runs both migrate and prepares the test database.

rake db:migrate && rake db:test:prepare

In your .bashrc just create an alias command like so and then run migrate_databases whenever you need to.

alias migrate_databases='rake db:migrate && rake db:test:prepare'
Nick Hammond
I prefer solve the problem instead of hide it, but thanks.BTW, sorry for answer a month later :)
pablorc