當我運行 '耙測試' 我得到這個錯誤:測試無表格模型
1)錯誤: test_the_truth(DetailsThankYouTest): 的ActiveRecord :: StatementInvalid:SQLite3的::的SQLException:沒有這樣的表:詳細信息:從「細節」刪除哪裏1 = 1
該應用程序運行良好,但我不能寫任何簡單的測試。我如何禁用Rails測試來使用表格?
當我運行 '耙測試' 我得到這個錯誤:測試無表格模型
1)錯誤: test_the_truth(DetailsThankYouTest): 的ActiveRecord :: StatementInvalid:SQLite3的::的SQLException:沒有這樣的表:詳細信息:從「細節」刪除哪裏1 = 1
該應用程序運行良好,但我不能寫任何簡單的測試。我如何禁用Rails測試來使用表格?
您是否偶然爲此模型添加了夾具文件?
Rails by default automatically loads all fixtures from the test/fixtures folder for your unit and functional test. Loading involves (...) removing any existing data from the table corresponding to the fixture.
大概你有一個沒有表本身但有子類的類。在這種情況下,您可以設置:
class Details < ActiveRecord::Base
self.abstract_class = true
end
我沒有任何的子類,但是這是一個善意的提醒反正 – rtacconi 2010-10-14 17:32:11
是在test_helper.rb中確實是 – rtacconi 2010-10-14 17:31:25