2019-03-30 07:15:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-04 15:38:16 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-04-18 19:26:56 +00:00
|
|
|
describe ExpirePipelineCacheWorker do
|
2017-04-04 15:38:16 +00:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 19:55:11 +00:00
|
|
|
let(:project) { create(:project) }
|
2017-04-04 15:38:16 +00:00
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
2017-04-18 19:26:56 +00:00
|
|
|
subject { described_class.new }
|
2017-04-04 15:38:16 +00:00
|
|
|
|
2017-04-18 19:26:56 +00:00
|
|
|
describe '#perform' do
|
2019-04-12 19:29:47 +00:00
|
|
|
it 'executes the service' do
|
|
|
|
expect_any_instance_of(Ci::ExpirePipelineCacheService).to receive(:execute).with(pipeline).and_call_original
|
2017-04-20 06:44:01 +00:00
|
|
|
|
|
|
|
subject.perform(pipeline.id)
|
|
|
|
end
|
|
|
|
|
2017-04-21 15:39:19 +00:00
|
|
|
it "doesn't do anything if the pipeline not exist" do
|
2019-04-12 19:29:47 +00:00
|
|
|
expect_any_instance_of(Ci::ExpirePipelineCacheService).not_to receive(:execute)
|
2017-04-21 15:39:19 +00:00
|
|
|
expect_any_instance_of(Gitlab::EtagCaching::Store).not_to receive(:touch)
|
|
|
|
|
|
|
|
subject.perform(617748)
|
|
|
|
end
|
2017-04-04 15:38:16 +00:00
|
|
|
end
|
|
|
|
end
|