summaryrefslogtreecommitdiff
path: root/spec/workers/users/deactivate_dormant_users_worker_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/users/deactivate_dormant_users_worker_spec.rb')
-rw-r--r--spec/workers/users/deactivate_dormant_users_worker_spec.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/spec/workers/users/deactivate_dormant_users_worker_spec.rb b/spec/workers/users/deactivate_dormant_users_worker_spec.rb
index 32291a143ee..934c497c79a 100644
--- a/spec/workers/users/deactivate_dormant_users_worker_spec.rb
+++ b/spec/workers/users/deactivate_dormant_users_worker_spec.rb
@@ -4,12 +4,12 @@ require 'spec_helper'
RSpec.describe Users::DeactivateDormantUsersWorker do
describe '#perform' do
+ let_it_be(:dormant) { create(:user, last_activity_on: User::MINIMUM_INACTIVE_DAYS.days.ago.to_date) }
+ let_it_be(:inactive) { create(:user, last_activity_on: nil) }
+
subject(:worker) { described_class.new }
it 'does not run for GitLab.com' do
- create(:user, last_activity_on: User::MINIMUM_INACTIVE_DAYS.days.ago.to_date)
- create(:user, last_activity_on: nil)
-
expect(Gitlab).to receive(:com?).and_return(true)
expect(Gitlab::CurrentSettings).not_to receive(:current_application_settings)
@@ -29,9 +29,6 @@ RSpec.describe Users::DeactivateDormantUsersWorker do
stub_const("#{described_class.name}::BATCH_SIZE", 1)
stub_const("#{described_class.name}::PAUSE_SECONDS", 0)
- create(:user, last_activity_on: User::MINIMUM_INACTIVE_DAYS.days.ago.to_date)
- create(:user, last_activity_on: nil)
-
expect(worker).to receive(:sleep).twice
worker.perform
@@ -48,9 +45,6 @@ RSpec.describe Users::DeactivateDormantUsersWorker do
end
it 'does nothing' do
- create(:user, last_activity_on: User::MINIMUM_INACTIVE_DAYS.days.ago.to_date)
- create(:user, last_activity_on: nil)
-
worker.perform
expect(User.dormant.count).to eq(1)