diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 15:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 15:07:52 +0000 |
commit | afe2b984524ae4b0c8a0636db7ec5b2c452f0734 (patch) | |
tree | 3de39f954c7239e09a9afe84263a64e7042b2b60 /spec/services/ci | |
parent | 5a6b36b60502c50ab59c0bc3c345793b70a3d548 (diff) | |
download | gitlab-ce-afe2b984524ae4b0c8a0636db7ec5b2c452f0734.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ci')
-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 |