summaryrefslogtreecommitdiff
path: root/spec/support/shared_contexts/container_repositories_shared_context.rb
blob: a74b09d38bdf909e3d31ab2948a2c66e2d43021a (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 'importable repositories' do
  let_it_be(:valid_container_repository) { create(:container_repository, created_at: 2.days.ago, migration_plan: 'free') }
  let_it_be(:valid_container_repository2) { create(:container_repository, created_at: 1.year.ago, migration_plan: 'free') }
  let_it_be(:importing_container_repository) { create(:container_repository, :importing, created_at: 2.days.ago, migration_plan: 'free') }
  let_it_be(:new_container_repository) { create(:container_repository, migration_plan: 'free') }

  let_it_be(:denied_root_group) { create(:group) }
  let_it_be(:denied_group) { create(:group, parent_id: denied_root_group.id) }
  let_it_be(:denied_project) { create(:project, group: denied_group) }
  let_it_be(:denied_container_repository) { create(:container_repository, project: denied_project, created_at: 2.days.ago) }

  before do
    stub_application_setting(container_registry_import_created_before: 1.day.ago)
    stub_feature_flags(
      container_registry_phase_2_deny_list: false,
      container_registry_migration_limit_gitlab_org: false,
      container_registry_migration_phase2_all_plans: false
    )

    Feature::FlipperGate.create!(
      feature_key: 'container_registry_phase_2_deny_list',
      key: 'actors',
      value: "Group:#{denied_root_group.id}"
    )
  end
end