Rails3 ActiveRecord::StatementInvalid:... no such table in every test
I've started learning rails3 few days ago, and since today, every time I run unit test for my model I get this error message:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: users: DELETE FROM "users" WHERE 1=1
The tests went smoothly yesterday, I run them today (reverting everything to the state from the time they were working)... and I'm still getting the error.
I'm using rails 3 release on Windows7 64 bit, SQLite 3.7.2, ruby 187 (but I do have many ruby installations - using pik to select 187)
Any ideas on fixi开发者_如何学编程ng this issue?
If you created the model using a rails generator, you may have left over fixture files that are trying to access a table that isn't there anymore. For me, deleting the yml file solved the issue.
This was answered here: https://stackoverflow.com/a/6222934
It would be worth checking that your test database is set up correctly using the schema from your development database. You can achieve this with:
rake db:test:prepare
精彩评论