Commit 31871f08 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'ek-add-specs-for-devise-mailer-password-reset-view' into 'master'

Add a spec for the mailer password reset view

See merge request gitlab-org/gitlab!59717
parents ef1acea7 9cf210ba
......@@ -94,4 +94,36 @@ RSpec.describe DeviseMailer do
is_expected.to have_link(Gitlab.config.gitlab.url)
end
end
describe '#reset_password_instructions' do
subject { described_class.reset_password_instructions(user, 'faketoken') }
let_it_be(:user) { create(:user) }
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like 'a user cannot unsubscribe through footer link'
it 'is sent to the user' do
is_expected.to deliver_to user.email
end
it 'has the correct subject' do
is_expected.to have_subject 'Reset password instructions'
end
it 'greets the user' do
is_expected.to have_body_text /Hello, #{user.name}!/
end
it 'includes the correct content' do
is_expected.to have_text /Someone, hopefully you, has requested to reset the password for your GitLab account on #{Gitlab.config.gitlab.url}/
is_expected.to have_body_text /If you did not perform this request, you can safely ignore this email./
is_expected.to have_body_text /Otherwise, click the link below to complete the process./
end
it 'includes a link to reset the password' do
is_expected.to have_link("Reset password", href: "#{Gitlab.config.gitlab.url}/users/password/edit?reset_password_token=faketoken")
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment