我知道理想的做法是填寫登錄表單並遵循該流程。問題是我沒有使用設計進行登錄。我使用Facebook和fb_graph gem進行身份驗證後,在我的應用程序中登錄了用戶。測試設計用黃瓜登錄
因此,設計的sign_in視圖只有鏈接「連接Facebook」,但我能夠看到該路線,並且我假設在用戶登錄該網址時會嘗試登錄該用戶。
我試圖做一個郵寄到sign_in(這觀點是空的)直接用黃瓜,和即使響應是確定的,用戶沒有登錄。
Given /^I am a logged in user$/ do
@user = Factory(:user)
res = post("https://stackoverflow.com/users/sign_in", :email => @user.email, :password => "password")
p res
end
如何測試呢?
感謝,
UPDATE:
的情況是這樣的:
Scenario: Going to the index page
Given I am a logged in user
And there is a subject created
And there is 1 person for that subject
When I go to that subject persons index page
And show me the page
Then I should see "Back to Subjects list"