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/emails/profile_spec.rb')
-rw-r--r--spec/mailers/emails/profile_spec.rb42
1 files changed, 37 insertions, 5 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb
index 767eddb7f98..cdc298d685e 100644
--- a/spec/mailers/emails/profile_spec.rb
+++ b/spec/mailers/emails/profile_spec.rb
@@ -152,7 +152,7 @@ RSpec.describe Emails::Profile do
end
it 'includes the email reason' do
- is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>}
+ is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>}
end
end
end
@@ -188,7 +188,7 @@ RSpec.describe Emails::Profile do
end
it 'includes the email reason' do
- is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>}
+ is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>}
end
context 'with User does not exist' do
@@ -223,7 +223,7 @@ RSpec.describe Emails::Profile do
end
it 'includes the email reason' do
- is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>}
+ is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>}
end
end
@@ -269,8 +269,40 @@ RSpec.describe Emails::Profile do
is_expected.to have_body_text /#{token.name}/
end
+ it 'wont include the revocation reason' do
+ is_expected.not_to have_body_text %r{We found your token in a public project and have automatically revoked it to protect your account.$}
+ end
+
+ it 'includes the email reason' do
+ is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>}
+ end
+ end
+
+ context 'when source is provided' do
+ subject { Notify.access_token_revoked_email(user, token.name, 'secret_detection') }
+
+ 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 personal access token has been revoked$/i
+ end
+
+ it 'provides the names of the token' do
+ is_expected.to have_body_text /#{token.name}/
+ end
+
+ it 'includes the revocation reason' do
+ is_expected.to have_body_text %r{We found your token in a public project and have automatically revoked it to protect your account.$}
+ end
+
it 'includes the email reason' do
- is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>}
+ is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>}
end
end
end
@@ -296,7 +328,7 @@ RSpec.describe Emails::Profile do
end
shared_examples 'includes the email reason' do
- it { is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost<\/a>} }
+ it { is_expected.to have_body_text %r{You're receiving this email because of your account on <a .*>localhost</a>} }
end
shared_examples 'valid use case' do