我已經通過這些頁面了,並試圖在這些網頁上發現了許多東西:FactoryGirl:工廠未註冊的發動機項目
FactoryGirl: Factory not registered: user (ArgumentError) Cannot get factory_girl running under rails 3.0.5,unexpected tCONSTANT 'Factory not registered' error in Rails 4 FactoryGirl: Factory not registered
但總是收到「工廠未註冊:用戶「
文件test/factories.rb(也試過test/factories/user_factory.rb)看起來像:
FactoryGirl.define do
factory :user do
login '[email protected]'
email '[email protected]'
end
end
存根測試:
it 'just_a_test_of_testing' do
u = FactoryGirl.create(:user)
end
不工作,給了我 「引發ArgumentError:工廠未註冊:用戶」
有誰知道 「正確的解決方案」?看起來它可能與「引擎」有關,但我不知道接下來要嘗試什麼,有什麼想法?也許這與用戶是測試/虛擬應用模型的事實有關?
該文件不存在;如果我創建它並添加它,它似乎沒有影響。我曾嘗試爲引擎和應用程序創建它 – Gerry