Commit f42a60ee authored by a_luna's avatar a_luna

Add missing spec for worker

parent b18cdc7a
...@@ -124,12 +124,21 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do ...@@ -124,12 +124,21 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do
describe '.last_enqueue_time' do describe '.last_enqueue_time' do
it 'returns last_enqueue_time from the cron job instance' do it 'returns last_enqueue_time from the cron job instance' do
time = Time.current time = Time.current
job = double(Sidekiq::Cron::Job, last_enqueue_time: time)
allow(Sidekiq::Cron::Job).to receive(:find) allow(Sidekiq::Cron::Job).to receive(:find)
.with('update_max_seats_used_for_gitlab_com_subscriptions_worker') .with('update_max_seats_used_for_gitlab_com_subscriptions_worker')
.and_return(job) .and_return(double(Sidekiq::Cron::Job, last_enqueue_time: time))
expect(described_class.last_enqueue_time).to eq(time) expect(described_class.last_enqueue_time).to eq(time)
end end
context 'when job is not found' do
it 'returns nil' do
allow(Sidekiq::Cron::Job).to receive(:find)
.with('update_max_seats_used_for_gitlab_com_subscriptions_worker')
.and_return(nil)
expect(described_class.last_enqueue_time).to be_nil
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment