views:

25

answers:

1

Hello, this is a very silly question I think: I just removed a table named person_emails I created a minute ago in a new demo app I created half an hour ago. Then I started testing like just now, when I ran a unit test on an unrelated model called line_item, and I got "ActiveRecord::StatementInvalid: Mysql::Error: Table 'depot_test.person_emails' doesn't exist: DELETE FROM person_emails"

I did do the rake db:test:prepare and rake db:migrate RAILS_ENV=test.

Also, I had this column named "price" in the line_items table which I used a migration to remove, but the test tests for it anyway and throws and error. Is there something that I always should do for tests after reverting a migration or using a migration to remove a column?

Any ideas?

Thank You!

A: 

I'm pretty sure this is happening because you still have a person_emails fixture file! It's trying to clear the table before it loads the fixture data. Check for a file called test/fixtures/person_emails.yml and delete it, and you should be set.

Jaime Bellmyer
That worked!! So I guess when you revert a migration, the lines the migration added to the fixtures won't be removed, and you have to remove them manually then. Thank You@
Nik