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>2022-09-23 21:12:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-23 21:12:59 +0300
commit3acaaf7231d0779a6ceb37fca693cd81e698ef90 (patch)
tree22a068ab03faa19008997f5bc10298282ad077ab /spec/mailers
parent2cba761741967eb6baf797af2ee0a702c2ffbdfe (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/emails/profile_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb
index fce55256922..f6f02f2ba39 100644
--- a/spec/mailers/emails/profile_spec.rb
+++ b/spec/mailers/emails/profile_spec.rb
@@ -396,6 +396,39 @@ RSpec.describe Emails::Profile do
end
end
+ describe 'user attempted sign in with wrong 2FA OTP email' do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:ip) { '169.0.0.1' }
+ let_it_be(:current_time) { Time.current }
+ let_it_be(:email) { Notify.two_factor_otp_attempt_failed_email(user, ip, current_time) }
+
+ subject { email }
+
+ 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 "Attempted sign in to #{Gitlab.config.gitlab.host} using a wrong two-factor authentication code"
+ end
+
+ it 'mentions the IP address' do
+ is_expected.to have_body_text ip
+ end
+
+ it 'mentioned the time' do
+ is_expected.to have_body_text current_time.strftime('%Y-%m-%d %H:%M:%S %Z')
+ end
+
+ it 'includes a link to the change password documentation' do
+ is_expected.to have_body_text 'https://docs.gitlab.com/ee/user/profile/#changing-your-password'
+ end
+ end
+
describe 'disabled two-factor authentication email' do
let_it_be(:user) { create(:user) }