2023-11-03 09:22:03 +01:00
|
|
|
describe Cron::ExpiredUsersDeletionJob do
|
|
|
|
subject { described_class.perform_now }
|
|
|
|
|
2023-11-04 08:45:40 +01:00
|
|
|
context 'when env[EXPIRE_USER_DELETION_JOB_LIMIT] is present' do
|
|
|
|
before { expect(ENV).to receive(:[]).with('EXPIRE_USER_DELETION_JOB_LIMIT').and_return('anything') }
|
2023-11-03 09:22:03 +01:00
|
|
|
|
2023-11-04 08:45:40 +01:00
|
|
|
it 'calls ExpiredUsersDeletionService.process_expired' do
|
|
|
|
expect(ExpiredUsersDeletionService).to receive(:process_expired)
|
2023-11-03 09:22:03 +01:00
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-11-04 08:45:40 +01:00
|
|
|
context 'when env[EXPIRE_USER_DELETION_JOB_LIMIT] is absent' do
|
|
|
|
it 'does not call ExpiredUsersDeletionService.process_expired' do
|
|
|
|
expect(ExpiredUsersDeletionService).not_to receive(:process_expired)
|
2023-11-03 09:22:03 +01:00
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|