diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-09-30 14:35:00 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-09-30 14:35:00 -0400 |
commit | 3a4274e19e1a1fbc23fb5fe0d6101ad62099aadb (patch) | |
tree | 55436b53e2ff47c8c48907b9328c095c95ebf566 /spec/features/password_reset_spec.rb | |
parent | 54452412f765d9e6e6166e105db9adbc7553aec2 (diff) | |
download | gitlab-ce-3a4274e19e1a1fbc23fb5fe0d6101ad62099aadb.tar.gz |
Take advantage of `Devise.sign_in_after_reset_password`rs-disable-signin-after-reset
Diffstat (limited to 'spec/features/password_reset_spec.rb')
-rw-r--r-- | spec/features/password_reset_spec.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/spec/features/password_reset_spec.rb b/spec/features/password_reset_spec.rb index 2b6311e4fd7..abf66f2356d 100644 --- a/spec/features/password_reset_spec.rb +++ b/spec/features/password_reset_spec.rb @@ -1,27 +1,6 @@ require 'spec_helper' feature 'Password reset', feature: true do - def forgot_password - click_on 'Forgot your password?' - fill_in 'Email', with: user.email - click_button 'Reset password' - user.reload - end - - def get_reset_token - mail = ActionMailer::Base.deliveries.last - body = mail.body.encoded - body.scan(/reset_password_token=(.+)\"/).flatten.first - end - - def reset_password(password = 'password') - visit edit_user_password_path(reset_password_token: get_reset_token) - - fill_in 'New password', with: password - fill_in 'Confirm new password', with: password - click_button 'Change your password' - end - describe 'with two-factor authentication' do let(:user) { create(:user, :two_factor) } @@ -40,14 +19,35 @@ feature 'Password reset', feature: true do describe 'without two-factor authentication' do let(:user) { create(:user) } - it 'automatically logs in after password reset' do + it 'requires login after password reset' do visit root_path forgot_password reset_password - expect(current_path).to eq root_path - expect(page).to have_content("Your password was changed successfully. You are now signed in.") + expect(page).to have_content("Your password was changed successfully.") + expect(current_path).to eq new_user_session_path end end + + def forgot_password + click_on 'Forgot your password?' + fill_in 'Email', with: user.email + click_button 'Reset password' + user.reload + end + + def get_reset_token + mail = ActionMailer::Base.deliveries.last + body = mail.body.encoded + body.scan(/reset_password_token=(.+)\"/).flatten.first + end + + def reset_password(password = 'password') + visit edit_user_password_path(reset_password_token: get_reset_token) + + fill_in 'New password', with: password + fill_in 'Confirm new password', with: password + click_button 'Change your password' + end end |