diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 18:07:55 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 18:07:55 +0000 |
| commit | 11df4bf91b8cf9ac7bb601241992e300eebf684c (patch) | |
| tree | d3c2360dbd3edec006a09ed150267dc202020a91 /spec/workers/ssh_keys | |
| parent | 6282dd78339f98cbc5624e7fdf744a342d3d8b73 (diff) | |
| download | gitlab-ce-11df4bf91b8cf9ac7bb601241992e300eebf684c.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/ssh_keys')
| -rw-r--r-- | spec/workers/ssh_keys/expired_notification_worker_spec.rb | 10 | ||||
| -rw-r--r-- | spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/spec/workers/ssh_keys/expired_notification_worker_spec.rb b/spec/workers/ssh_keys/expired_notification_worker_spec.rb index be38391ff8c..26d9460d73e 100644 --- a/spec/workers/ssh_keys/expired_notification_worker_spec.rb +++ b/spec/workers/ssh_keys/expired_notification_worker_spec.rb @@ -16,12 +16,12 @@ RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker do let_it_be(:user) { create(:user) } context 'with a large batch' do + let_it_be_with_reload(:keys) { create_list(:key, 20, :expired_today, user: user) } + before do stub_const("SshKeys::ExpiredNotificationWorker::BATCH_SIZE", 5) end - let_it_be_with_reload(:keys) { create_list(:key, 20, expires_at: Time.current, user: user) } - it 'updates all keys regardless of batch size' do worker.perform @@ -30,7 +30,7 @@ RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker do end context 'with expiring key today' do - let_it_be_with_reload(:expired_today) { create(:key, expires_at: Time.current, user: user) } + let_it_be_with_reload(:expired_today) { create(:key, :expired_today, user: user) } it 'invoke the notification service' do expect_next_instance_of(Keys::ExpiryNotificationService) do |expiry_service| @@ -52,7 +52,7 @@ RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker do end context 'when key has expired in the past' do - let_it_be(:expired_past) { create(:key, expires_at: 1.day.ago, user: user) } + let_it_be(:expired_past) { create(:key, :expired, user: user) } it 'does not update notified column' do expect { worker.perform }.not_to change { expired_past.reload.expiry_notification_delivered_at } @@ -60,7 +60,7 @@ RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker do context 'when key has already been notified of expiration' do before do - expired_past.update!(expiry_notification_delivered_at: 1.day.ago) + expired_past.update_attribute(:expiry_notification_delivered_at, 1.day.ago) end it 'does not update notified column' do diff --git a/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb b/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb index 0a1d4a14ad0..e907d035020 100644 --- a/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb +++ b/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb @@ -38,7 +38,7 @@ RSpec.describe SshKeys::ExpiringSoonNotificationWorker, type: :worker do end context 'when key has expired in the past' do - let_it_be(:expired_past) { create(:key, expires_at: 1.day.ago, user: user) } + let_it_be(:expired_past) { create(:key, :expired, user: user) } it 'does not update notified column' do expect { worker.perform }.not_to change { expired_past.reload.before_expiry_notification_delivered_at } |
