scenario 'HP: User Sign Up w/ Confirmable Email and Log in ' do
visit new_user_registration_path
fill_in 'Email', with: 'test_user_confirmable@example.com'
fill_in 'Password', with: 'password'
fill_in 'Password confirmation', with: 'password'
assert_difference 'User.count', 1 do
click_button 'Sign up'
mail = ActionMailer::Base.deliveries[0]
token = mail.body.decoded.match(/confirmation_token=([^"]+)/)[1]
assert_equal User.find_by(email: "test_user_confirmable@example.com").confirmation_token, token
visit "users/confirmation?confirmation_token=#{token}"
page.must_have_text "Your email address has been successfully confirmed."
fill_in 'Email', with: 'test_user_confirmable@example.com'
fill_in 'Password', with: 'password'
click_button 'Log in'
page.must_have_text "Signed in successfully."
end
end
Created
March 22, 2016 20:12
-
-
Save trendwithin/1d2a6721c89d5bf91f51 to your computer and use it in GitHub Desktop.
Devise Confirmable Capybara Test
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much! It helps me alot.