2013-07-03 119 views
0

我正在用戶登錄功能在黃瓜和那裏我必須測試,如果用戶登錄成功。一切順利,除了最後一行:undefined method should_receive'for

Then I should be redirected to my home page 

問題是,它不是正常的登錄,它需要票。門票從ApplicationController#login_ticket獲得。我想它存根,所以我寫了這個網站的步驟:

Then(/^I should be redirected to my home page$/) do 
    ApplicationController.should_receive(:login_ticket).and_return("2081677") 
    current_path.should eq root_path 
end 

但它失敗消息:

然後,我應該被重定向到我的主頁# 功能/ step_definitions/web_steps.rb: 13 未定義的方法should_receive' for ApplicationController:Class (NoMethodError) ./features/step_definitions/web_steps.rb:14:in/^我應該被重定向到我的主頁$ /「 功能/ UserLogin.feature:9:'那麼我應該被重定向到我的主頁」

這裏有什麼問題?

回答

相關問題