我试图测试用户注册。使用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