autotest errors after migration?
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 widgetsautotest 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:
- Run
rake db:test:prepare. This applies the current development schema to your test database. - Press Ctrl-C (once) in your autotest window. That tells autotest to restart itself and run the full test suite.