summaryrefslogtreecommitdiff
path: root/spec/services/ci/expire_pipeline_cache_service_spec.rb
blob: 3c735872c30c8dd51c558915c08d6c98dd8eb6fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper'

describe Ci::ExpirePipelineCacheService, services: true do
  let(:user) { create(:user) }
  let(:project) { create(:empty_project) }
  let(:pipeline) { create(:ci_pipeline, project: project) }
  subject { described_class.new(project, user) }

  describe '#execute' do
    it 'invalidate Etag caching for project pipelines path' do
      pipelines_path = "/#{project.full_path}/pipelines.json"
      new_mr_pipelines_path = "/#{project.full_path}/merge_requests/new.json"

      expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(pipelines_path)
      expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(new_mr_pipelines_path)

      subject.execute(pipeline)
    end
  end
end