summaryrefslogtreecommitdiff
path: root/spec/mailers/devise_mailer_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/mailers/devise_mailer_spec.rb
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/mailers/devise_mailer_spec.rb')
-rw-r--r--spec/mailers/devise_mailer_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/mailers/devise_mailer_spec.rb b/spec/mailers/devise_mailer_spec.rb
index c9dfee8255d..2634d7c722b 100644
--- a/spec/mailers/devise_mailer_spec.rb
+++ b/spec/mailers/devise_mailer_spec.rb
@@ -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