diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-06 00:09:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-06 00:09:53 +0000 |
commit | 631ed6dcca9d41d0dc24dd553065de1a0f8210f0 (patch) | |
tree | e644e0f962e7f6ce664e37d415edf0c584711cdb /spec/mailers | |
parent | ad9eb72915f1be40da3ebe287274fe2bae62e46b (diff) | |
download | gitlab-ce-631ed6dcca9d41d0dc24dd553065de1a0f8210f0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/profile_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb index ee91df360b6..fbbdef5feee 100644 --- a/spec/mailers/emails/profile_spec.rb +++ b/spec/mailers/emails/profile_spec.rb @@ -157,6 +157,56 @@ RSpec.describe Emails::Profile do end end + describe 'user personal access token has expired' do + let_it_be(:user) { create(:user) } + + context 'when valid' do + subject { Notify.access_token_expired_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 token has expired/ + end + + it 'mentions the access token has expired' do + is_expected.to have_body_text /One or more of your personal access tokens has expired/ + 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 + end + + context 'when invalid' do + context 'when user does not exist' do + it do + expect { Notify.access_token_expired_email(nil) }.not_to change { ActionMailer::Base.deliveries.count } + end + end + + context 'when user is not active' do + before do + user.block! + end + + it do + expect { Notify.access_token_expired_email(user) }.not_to change { ActionMailer::Base.deliveries.count } + end + end + end + end + describe 'user unknown sign in email' do let_it_be(:user) { create(:user) } let_it_be(:ip) { '169.0.0.1' } |