Commit 35eb3fa2 authored by Peter Leitzen's avatar Peter Leitzen

Extract idempotent constant into a `let`

So we can use a shorter name within specs.
parent d4699d09
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
# end # end
# #
RSpec.shared_examples 'an idempotent worker' do RSpec.shared_examples 'an idempotent worker' do
let(:worker_exec_times) { IdempotentWorkerHelper::WORKER_EXEC_TIMES }
# Avoid stubbing calls for a more accurate run. # Avoid stubbing calls for a more accurate run.
subject do subject do
defined?(job_args) ? perform_multiple(job_args) : perform_multiple defined?(job_args) ? perform_multiple(job_args) : perform_multiple
......
...@@ -21,12 +21,12 @@ describe ExpireJobCacheWorker do ...@@ -21,12 +21,12 @@ describe ExpireJobCacheWorker do
allow(Gitlab::EtagCaching::Store).to receive(:new) { spy_store } allow(Gitlab::EtagCaching::Store).to receive(:new) { spy_store }
expect(spy_store).to receive(:touch) expect(spy_store).to receive(:touch)
.exactly(IdempotentWorkerHelper::WORKER_EXEC_TIMES).times .exactly(worker_exec_times).times
.with(pipeline_path) .with(pipeline_path)
.and_call_original .and_call_original
expect(spy_store).to receive(:touch) expect(spy_store).to receive(:touch)
.exactly(IdempotentWorkerHelper::WORKER_EXEC_TIMES).times .exactly(worker_exec_times).times
.with(job_path) .with(job_path)
.and_call_original .and_call_original
......
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