我試圖測試用戶註冊。使用Rails +設計1.1.rc2 我有這樣的測試:測試用戶註冊黃瓜 - 失敗
Given I am on the landing page
When I go to the registration page
And I fill in "Firstname" with "F"
And I fill in "Lastname" with "L"
And I fill in "Country" with "C"
And I fill in "State" with "S"
And I fill in "City" with "C"
And I fill in "Email" with "[email protected]"
And I fill in "Password" with "password"
And I fill in "Password Confirmation" with "password"
And I press "Register"
Then I should see "You have registered successfully. If enabled, a confirmation was sent your e-mail."
這是錯誤片段:
expected the following element's content to include "You have registered successfully. If enabled, a confirmation was sent your e-mail.":
You are being redirected. (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:145:in `/^(?:|I)should see "([^"]*)"$/'
features/registration.feature:42:in `Then I should see "You have registered successfully. If enabled, a confirmation was sent your e-mail."
我認爲它有事情做一個重定向,不知道如何解決這個問題?但在我app_controller.rb我有這個所以用戶被引導到儀表板頁面...
def after_sign_in_path_for(resource_or_scope)
"/dashboard"
end
它只是測試這就是失敗的,實際的註冊功能是好的。
太可怕了......介紹請乾淨,如果你想別人看 – apneadiving 2011-04-09 21:56:17