summaryrefslogtreecommitdiff
path: root/spec/support/shared_contexts/models/ci/job_token_scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_contexts/models/ci/job_token_scope.rb')
-rw-r--r--spec/support/shared_contexts/models/ci/job_token_scope.rb34
1 files changed, 20 insertions, 14 deletions
diff --git a/spec/support/shared_contexts/models/ci/job_token_scope.rb b/spec/support/shared_contexts/models/ci/job_token_scope.rb
index 51f671b139d..d0fee23b57c 100644
--- a/spec/support/shared_contexts/models/ci/job_token_scope.rb
+++ b/spec/support/shared_contexts/models/ci/job_token_scope.rb
@@ -1,21 +1,27 @@
# 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) }
+RSpec.shared_context 'with a project in each allowlist' do
+ let_it_be(:outbound_allowlist_project) { create_project_in_allowlist(source_project, direction: :outbound) }
+
+ include_context 'with inaccessible projects'
+end
+
+RSpec.shared_context 'with accessible and inaccessible projects' do
+ let_it_be(:outbound_allowlist_project) { create_project_in_allowlist(source_project, direction: :outbound) }
+ let_it_be(:inbound_accessible_project) { create_inbound_accessible_project(source_project) }
+ let_it_be(:fully_accessible_project) { create_inbound_and_outbound_accessible_project(source_project) }
+
+ include_context 'with inaccessible projects'
+end
+
+RSpec.shared_context 'with inaccessible projects' do
+ let_it_be(:inbound_allowlist_project) { create_project_in_allowlist(source_project, direction: :inbound) }
+ include_context 'with unscoped projects'
+end
+
+RSpec.shared_context 'with unscoped projects' do
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