From afe2b984524ae4b0c8a0636db7ec5b2c452f0734 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 5 Mar 2020 15:07:52 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../ci/find_exposed_artifacts_service_spec.rb | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'spec/services/ci/find_exposed_artifacts_service_spec.rb') diff --git a/spec/services/ci/find_exposed_artifacts_service_spec.rb b/spec/services/ci/find_exposed_artifacts_service_spec.rb index b0f190b0e7a..16e23253c34 100644 --- a/spec/services/ci/find_exposed_artifacts_service_spec.rb +++ b/spec/services/ci/find_exposed_artifacts_service_spec.rb @@ -172,5 +172,47 @@ describe Ci::FindExposedArtifactsService do ]) end end + + context 'cross-project MR' do + let!(:foreign_project) { create(:project) } + let!(:pipeline) { create(:ci_pipeline, project: foreign_project) } + + let!(:job_show) do + create_job_with_artifacts({ + artifacts: { + expose_as: 'file artifact', + paths: ['ci_artifacts.txt'] + } + }) + end + + let!(:job_browse) do + create_job_with_artifacts({ + artifacts: { + expose_as: 'directory artifact', + paths: ['tests_encoding/'] + } + }) + end + + subject { described_class.new(project, user).for_pipeline(pipeline, limit: 2) } + + it 'returns the correct path for cross-project MRs' do + expect(subject).to eq([ + { + text: 'file artifact', + url: file_project_job_artifacts_path(foreign_project, job_show, 'ci_artifacts.txt'), + job_name: job_show.name, + job_path: project_job_path(foreign_project, job_show) + }, + { + text: 'directory artifact', + url: browse_project_job_artifacts_path(foreign_project, job_browse), + job_name: job_browse.name, + job_path: project_job_path(foreign_project, job_browse) + } + ]) + end + end end end -- cgit v1.2.3