[rspec-users] spec:models depends on development db:migration

Bryan Helmkamp lists at brynary.com
Sun Oct 21 15:35:53 EDT 2007

On 10/18/07, Keith McDonnell <keith at dancingtext.com> wrote:
> rake spec:models seems to clone the test database from development. If
> your dev db is empty, the models task fails mysteriously.
> Anyway, to make sure your dev db is at the current migration version, I
> added this dependency in lib/tasks
> task 'spec:models' => 'db:migrate'
> Now the dev db is migrated up with each test pass.

In my projects I actually go out of my way to remove the DB clone task
as a dependency for spec tasks. The reason is pure speed. It shaves a
few seconds off every run at the expense of having to manually run
RAILS_ENV=test rake db:migrate after schema changes.

Perhaps we should consider a change to remove the dependency in RSpec
core but provide specific error messaging should the problem occur.
And it would be simple enough to have the db:migrate rake task migrate
both the dev and test databases should they exist.


Bryan Helmkamp
http://brynary.com -- My blog

More information about the rspec-users mailing list