diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-07 06:15:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-07 06:15:33 +0000 |
commit | 0ead22f9db870eb1d6914ef60d5c1c998ed538d9 (patch) | |
tree | 42cc4f297aa116bc517c86c943428ef0840b70ef /spec/mailers | |
parent | 9d20ce8c998506a1e27c55bbf99cd4c0595185af (diff) | |
download | gitlab-ce-0ead22f9db870eb1d6914ef60d5c1c998ed538d9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/profile_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb index af77989dbbc..1c4e4a670b4 100644 --- a/spec/mailers/emails/profile_spec.rb +++ b/spec/mailers/emails/profile_spec.rb @@ -123,6 +123,39 @@ RSpec.describe Emails::Profile do end end + describe 'user personal access token has been created' do + let_it_be(:user) { create(:user) } + let_it_be(:token) { create(:personal_access_token, user: user) } + + context 'when valid' do + subject { Notify.access_token_created_email(user, token.name) } + + 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 /^A new personal access token has been created$/i + end + + it 'provides the names of the token' do + is_expected.to have_body_text /#{token.name}/ + 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 + end + describe 'user personal access token is about to expire' do let_it_be(:user) { create(:user) } let_it_be(:expiring_token) { create(:personal_access_token, user: user, expires_at: 5.days.from_now) } |