0
我很難測試導軌3.2引擎。測試導軌3.2引擎與測試::單位
我做到以下幾點:
# generate the engine
rails plugin new myengine --mountable
cd myengine
# generate user resource
rails generate scaffold user name email password_digest
# try to run rake test from myengine root folder
rake test
=> NoMethodError: undefined method `users' for #<myengine::UsersControllerTest>
所以我試試這個:
cd test/dummy
rake myengine:install:migrations
rake db:migrate db:test:prepare
rake test # from within test/dummy
=> # nothing happens, no output
回到發動機的根文件夾
cd ../..
rake test
=> NoMethodError: undefined method `users' for #<myengine::UsersControllerTest>
我懷疑未定義的方法是指以下在我UsersContrllerTest頂部的線:
setup do
@user = users(:one)
end
我確實有固定裝置,它們是與腳手架的其餘部分一起生成的,並且我沒有弄亂任何代碼,只是完成了上述步驟。