I'm trying to test the devise feature for reseting a password, but I'm having some issues trying to test the link in the mail and visiting the page that is linked to.
I've tried unsuccessfully 2 ways to do it:
1)
scenario "User resets his password" do
user2 = FactoryGirl.create(
:user, reset_password_token: "new_password",
)
visit new_user_password_path
fill_in "Email", with: user2.email
click_on "Send me reset password instructions"
open_email(user2.email)
click_first_link_in_email
expect(page).to have_content("Reset your password")
end
If I do this I get the error:
Failure/Error: click_first_link_in_email
ActionController::RoutingError:
No route matches [GET] "/1999/xhtml'"
2)
scenario "User resets his password" do
user2 = FactoryGirl.create( :user, reset_password_token: "new_password" )
visit edit_user_password_path(reset_password_token:
expect(page).to have_content("Reset your password")
end
If I do this it takes me to the initial page saying:
"You can't access this page without coming from a password reset email"
Aucun commentaire:
Enregistrer un commentaire