我使用的設計進行用戶認證,並具有以下黃瓜失敗失敗的情況:登錄測試與設計和黃瓜
Scenario: Log in to the system
Given a user called "test" with a password of "secret"
And I am not logged in # Just visits /users/sign_out
When I go to the log in page
And I fill in "user_username" with "test"
And I fill in "user_password" with "secret"
And I press "Sign in"
Then I should see "Signed in successfully."
如果我堅持一個「那麼告訴我的頁面」的結尾我」 m顯示了一個空白日誌形式的頁面。
以下(非常相似)的測試原理:
Scenario: Fail to log in with invalid credentials
Given a user called "test" with a password of "secret"
And I am not logged in
When I go to the log in page
And I fill in "user_username" with "test"
And I fill in "user_password" with "invalid password"
And I press "Sign in"
Then I should see "Invalid email or password."
...所以我假設在日誌中做了重定向驗證成功,黃瓜不繼後(FWIW在日誌中所有的作品,當我在瀏覽器中手動執行)...任何人都可以告訴我如何通過測試?
感謝, 灰
編輯:「(在簽名成功」),這是一個與一個?預計#has_content「失敗的最後一步返回true,得到了假」的錯誤(...啊哈。 ..應該在前面提到過!)
是的,他們是外地ID。我不認爲它在這方面存在問題 - 另一項測試正在通過,所以我知道他們正在爲正常工作而正確填寫。 「當我進入登錄頁面」是一個Capybara步驟,在paths.rb中添加了「登錄頁面」。再次,不要認爲這是問題 - 我無法擺脫那個頁面,因此它顯示在「向我顯示頁面」! – Ash 2011-01-24 15:13:35
和測試用戶的祕密(我知道你混淆了),但該夾具或工廠也存在? – pjammer 2011-01-24 15:20:32