Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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