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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 10:53:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 10:53:40 +0300
commitcfc792b9ca064990e6540cb742e80529ea669a81 (patch)
tree147cd4256319990cebbc02fe8e4fbbbe06f5720a /spec/mailers
parent93c6764dacd4c605027ef1cd367d3aebe420b223 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/emails/profile_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb
index d340f207dc7..58c04fb4834 100644
--- a/spec/mailers/emails/profile_spec.rb
+++ b/spec/mailers/emails/profile_spec.rb
@@ -122,4 +122,38 @@ describe Emails::Profile do
it { expect { Notify.new_gpg_key_email('foo') }.not_to raise_error }
end
end
+
+ describe 'user personal access token is about to expire' do
+ let_it_be(:user) { create(:user) }
+
+ subject { Notify.access_token_about_to_expire_email(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 /^Your Personal Access Tokens will expire in 7 days or less$/i
+ end
+
+ it 'mentions the access tokens will expire' do
+ is_expected.to have_body_text /One or more of your personal access tokens will expire in 7 days or less/
+ end
+
+ it 'includes a link to personal access tokens page' do
+ is_expected.to have_body_text /#{profile_personal_access_tokens_path}/
+ end
+
+ it 'includes the email reason' do
+ is_expected.to have_body_text /You're receiving this email because of your account on localhost/
+ end
+
+ context 'with User does not exist' do
+ it { expect { Notify.access_token_about_to_expire_email('foo') }.not_to raise_error }
+ end
+ end
end