2012-10-11 59 views
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 

我確實有固定裝置,它們是與腳手架的其餘部分一起生成的,並且我沒有弄亂任何代碼,只是完成了上述步驟。

回答

0

似乎有人在8個月前打開了一張票,而Rails團隊關閉了它,沒有修復它。要解決的步驟詳見this Github issue的評論。