【发布时间】:2013-06-30 17:11:25
【问题描述】:
我将 Mongoid 与 Rails 一起使用,但所有已生成的功能测试都失败并出现类似以下错误:
test_should_get_new(PostsControllerTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: comments: DELETE FROM "comments"
这些是生成的测试:
require 'test_helper'
class PostsControllerTest < ActionController::TestCase
setup do
@post = posts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:posts)
end
test "should get new" do
get :new
assert_response :success
end
[...]
end
我应该更改测试吗?或者删除一些对 ActiveRecord 或 Sqlite 的引用? (我的 gemfile 中仍然有 sqlite,因为我在删除它时遇到了问题,并且仍然不确定如何从应用程序中完全删除它,因为我没有将它用于任何事情)
【问题讨论】:
标签: ruby-on-rails sqlite mongodb activerecord mongoid