autotest errors after migration?

Posted by Bob Showalter Sun, 24 Jun 2007 00:15:00 GMT

If you generate a new model or run a migration that makes changes to your database, autotest will probably start reporting errors.

For instance, if you generate a new model, edit the migration and then rake db:migrate, you might see something like this:

ActiveRecord::StatementInvalid: Mysql::Error: #42S02Table 'sample_test.widgets' doesn't exist: DELETE FROM widgets

autotest is really smart, which is great. But this one trips it up a bit. The problem is that autotest is running your new widget_test.rb, which is trying to load your new Widget fixtures. However, rake db:migrate only affects your production database, not your test database.

The fix is simple:

  1. Run rake db:test:prepare. This applies the current development schema to your test database.
  2. Press Ctrl-C (once) in your autotest window. That tells autotest to restart itself and run the full test suite.
Comments

Leave a response

Comments