Rails3 ActiveRecord::StatementInvalid:... 在每个测试中都没有这样的表 [英] Rails3 ActiveRecord::StatementInvalid:... no such table in every test
问题描述
几天前我开始学习 rails3,从今天开始,每次我为我的模型运行单元测试时,我都会收到以下错误消息:
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.
我在 Windows7 64 位、SQLite 3.7.2、ruby 187 上使用 rails 3 版本(但我确实有很多 ruby 安装 - 使用 pik 选择 187)
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 fixing this issue?
推荐答案
使用开发数据库中的架构检查是否正确设置了测试数据库是值得的.您可以通过以下方式实现:
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
这篇关于Rails3 ActiveRecord::StatementInvalid:... 在每个测试中都没有这样的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!