我正在使用不带数据库的rails3,并想知道在database.yml中应该通过rake测试。 它现在失败了。我还没有在文件中指定任何内容。我的模型将使用ActiveModel。
class User
# https://github.com/rails/rails/tree/master/activemodel
include ActiveModel::Validations
include ActiveModel::Conversion
...
end
运行rake测试:
runtime/lib/ruby/gems/1.8/gems/memory_test_fix-0.1.3/lib/memory_test_fix.rb:29:in `in_memory_database?': undefined method `[]' for false:FalseClass (NoMethodError)
...
答案 0 :(得分:7)
以下内容必须在application.rb中:
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
而不是
require 'rails/all'
答案 1 :(得分:0)
从您的environment.rb中删除活动记录
config.frameworks -= [ :active_record ]