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

job_token_scope.rb « ci « models « shared_contexts « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51f671b139d69e78fe78444a8f73b51b537ccfd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

RSpec.shared_context 'with scoped projects' do
  let_it_be(:inbound_scoped_project) { create_scoped_project(source_project, direction: :inbound) }
  let_it_be(:outbound_scoped_project) { create_scoped_project(source_project, direction: :outbound) }
  let_it_be(:unscoped_project1) { create(:project) }
  let_it_be(:unscoped_project2) { create(:project) }

  let_it_be(:link_out_of_scope) { create(:ci_job_token_project_scope_link, target_project: unscoped_project1) }

  def create_scoped_project(source_project, direction:)
    create(:project).tap do |scoped_project|
      create(
        :ci_job_token_project_scope_link,
        source_project: source_project,
        target_project: scoped_project,
        direction: direction
      )
    end
  end
end