Add spec to prove issue #28
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
832d1e3bd7
commit
b9259958f4
32
spec/features/devise/password_reset.rb
Normal file
32
spec/features/devise/password_reset.rb
Normal file
@ -0,0 +1,32 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Password reset', type: :feature do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
login_as user, :scope => :user
|
||||
end
|
||||
|
||||
scenario 'Send password reset email' do
|
||||
expect(user.reset_password_token).to be_nil
|
||||
|
||||
visit settings_account_path
|
||||
click_button "Send me a password reset link"
|
||||
expect(page).to have_content 'Please check your inbox'
|
||||
expect(user.reload.reset_password_token).to be_a(String)
|
||||
end
|
||||
|
||||
scenario "Reset password" do
|
||||
# Generate a raw reset token, since the stored one is only a digest
|
||||
token = user.send(:set_reset_password_token)
|
||||
logout
|
||||
visit edit_user_password_path(reset_password_token: token)
|
||||
expect(page).to have_content 'Change your password'
|
||||
|
||||
fill_in :user_password, with: 'a new password'
|
||||
fill_in :user_password_confirmation, with: 'a new password with a typo'
|
||||
click_button 'Change my password'
|
||||
|
||||
expect(page).to have_content 'Confirmation does not match'
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user