4
我已經開始爲我的控制器編寫測試。對於其中一次,我需要登錄,以檢查頁面是否呈現等。Rspec Rails - 模擬成爲current_user來測試控制器
因爲我使用的Devise在用戶模型上有一個current_user helper,我該如何形成我的:
describe "when it GETS 'town'" do
it "should render the template and be successful" do
get :index
response.should render_template(:index)
response.should be_success
end
end
這樣我就不會得到未定義的「驗證!」方法(設計特定)錯誤?