Skip to content

Commit b80f193

Browse files
sssash18SidharthBansal
authored andcommitted
Added reset_password_verification_est (#7302)
1 parent 74031d9 commit b80f193

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/functional/users_controller_test.rb

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class UsersControllerTest < ActionController::TestCase
44
include ActiveJob::TestHelper
5+
include ActionMailer::TestHelper
56
def setup
67
activate_authlogic
78

@@ -348,4 +349,23 @@ def setup
348349
get :verify_email, params: { token: email_verification_token }
349350
assert_equal "Successfully verified email", flash[:notice]
350351
end
352+
353+
test 'Reset password verification' do
354+
user = users(:bob)
355+
post 'reset', params:{
356+
email: user[:email]
357+
}
358+
key = user.generate_reset_key
359+
user.save
360+
email = PasswordResetMailer.reset_notify(user, key)
361+
assert_emails 1 do
362+
email.deliver_now
363+
end
364+
assert_not_nil email.to
365+
assert_equal 'Reset your password',email.subject
366+
assert_match 'Someone (probably you) has requested a reset of your password. To reset your password, click here:',email.body.to_s
367+
assert_response :redirect
368+
assert_redirected_to '/login'
369+
assert_match 'You should receive an email with instructions on how to reset your password. If you do not, please double check that you are using the email you',flash[:notice]
370+
end
351371
end

0 commit comments

Comments
 (0)