diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-01 00:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-01 00:09:15 +0300 |
commit | 9c918ae5c688cf492589be0c082956fd72aacea7 (patch) | |
tree | 21b7e3ef09c140c22491f2e583887fc2924c7f16 /spec/services/notification_service_spec.rb | |
parent | 676109e1b32682bdbdd94a9ffbd8743784f35521 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index ad833bb7c71..63bfc090a0d 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -288,6 +288,27 @@ RSpec.describe NotificationService, :mailer do end end end + + describe '#ssh_key_expired' do + let_it_be(:user) { create(:user) } + let_it_be(:fingerprints) { ["aa:bb:cc:dd:ee:zz"] } + + subject { notification.ssh_key_expired(user, fingerprints) } + + it 'sends email to the token owner' do + expect { subject }.to have_enqueued_email(user, fingerprints, mail: "ssh_key_expired_email") + end + + context 'when user is not allowed to receive notifications' do + before do + user.block! + end + + it 'does not send email to the token owner' do + expect { subject }.not_to have_enqueued_email(user, fingerprints, mail: "ssh_key_expired_email") + end + end + end end describe '#unknown_sign_in' do |