diff options
Diffstat (limited to 'spec/services/ci/find_exposed_artifacts_service_spec.rb')
-rw-r--r-- | spec/services/ci/find_exposed_artifacts_service_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
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 |