diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:25:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-28 01:25:55 +0300 |
commit | f0f3848e7a0b458c35a1adf3cb1cca29a205a60e (patch) | |
tree | 99be436b75910a7242204c42eb8196ab3ac3e826 /spec/support | |
parent | 6d091758c4b17e6463a4476cab30d8bf258a3400 (diff) |
Add latest changes from gitlab-org/security/gitlab@16-4-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_contexts/ci/yaml_processor_shared_context.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/ci/yaml_processor_shared_context.rb b/spec/support/shared_contexts/ci/yaml_processor_shared_context.rb new file mode 100644 index 00000000000..3b4d6fcef6f --- /dev/null +++ b/spec/support/shared_contexts/ci/yaml_processor_shared_context.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.shared_context 'when a project repository contains a forked commit' do + include ProjectForksHelper + + let_it_be(:project) { create(:project, :repository) } + let_it_be(:repository) { project.repository } + let_it_be(:forked_project) { fork_project(project, project.owner, repository: true) } + + let_it_be(:forked_commit_sha) do + forked_project.repository.create_file(project.owner, 'file.txt', 'file', message: 'test', branch_name: 'master') + end + + before_all do + # Creating this MR moves the forked commit to the project repository + create(:merge_request, source_project: forked_project, target_project: project) + end + + def mock_branch_contains_forked_commit_sha + allow(repository).to receive(:branch_names_contains).with(forked_commit_sha, limit: 1).and_return(['branch1']) + end +end |