Testing and migrations

does rails always need to update the development database before
running the
tests? It seems to insisit on running db:migrate before. Why can’t it
just update
the test database? This can be annoying if I’m in a production
environment and I
don’t want a migration to happen until I know the tests pass. How are
people
dealing with this?

Rake db:test:clone?

anywho wrote:

does rails always need to update the development database before
running the
tests? It seems to insisit on running db:migrate before. Why can’t it
just update
the test database? This can be annoying if I’m in a production
environment and I
don’t want a migration to happen until I know the tests pass.

Your production DB is not the dev DB, so you needn’t migrate it before
tests pass You can also just migrate the test DB itself

How are

people
dealing with this?

On Sun, Jun 27, 2010 at 6:47 AM, Marnen Laibow-Koser
[email protected] wrote:

anywho wrote:

does rails always need to update the development database before
running the
tests? It seems to insisit on running db:migrate before.

Your production DB is not the dev DB, so you needn’t migrate it before
tests pass You can also just migrate the test DB itself

Which ignores the original question, rephrased:

  1. generate a migration
  2. migrate your test db
  3. run rake test:units

You’ll get a prompt to run migrations, which only goes away if you
migrate your development db.

I also find that behavior strange.


Hassan S. ------------------------ [email protected]
twitter: @hassan

I also don’t use Test::Unit. I use Rspec, and I assumed, correctly it
would seem, that the behavior was the same.

Rake db:test:clone just clones from the development, no?

Hassan S. wrote:

On Sun, Jun 27, 2010 at 6:47 AM, Marnen Laibow-Koser
[email protected] wrote:

anywho wrote:

does rails always need to update the development database before
running the
tests? It seems to insisit on running db:migrate before.

Your production DB is not the dev DB, so you needn’t migrate it before
tests pass � You can also just migrate the test DB itself

Which ignores the original question, rephrased:

  1. generate a migration
  2. migrate your test db
  3. run rake test:units

You’ll get a prompt to run migrations, which only goes away if you
migrate your development db.

I also find that behavior strange.

I’ve never done it in that order, so didn’t realize that part. I also
don’t use Test::Unit; not sure if that’s significant. Thanks for the
clarification.


Hassan S. ------------------------ [email protected]
twitter: @hassan

yes it does