Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cleanup_tags_service_shared_context.rb « container_repository « projects « shared_contexts « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c976bbe921217ee127e232de7ce3006c368b4231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

RSpec.shared_context 'for a cleanup tags service' do
  def expected_service_response(status: :success, deleted: [], original_size: tags.size)
    {
      status: status,
      deleted: deleted,
      original_size: original_size,
      before_delete_size: deleted&.size
    }.compact.merge(deleted_size: deleted&.size)
  end

  def expect_delete(tags, container_expiration_policy: nil)
    service = instance_double('Projects::ContainerRepository::DeleteTagsService')

    expect(Projects::ContainerRepository::DeleteTagsService)
      .to receive(:new)
      .with(repository.project, user, tags: tags, container_expiration_policy: container_expiration_policy)
      .and_return(service)

    expect(service).to receive(:execute)
                   .with(repository) { { status: :success, deleted: tags } }
  end

  def expect_no_caching
    expect(::Gitlab::Redis::Cache).not_to receive(:with)
  end
end