diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 21:07:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 21:07:55 +0300 |
commit | 11df4bf91b8cf9ac7bb601241992e300eebf684c (patch) | |
tree | d3c2360dbd3edec006a09ed150267dc202020a91 /spec/lib/api | |
parent | 6282dd78339f98cbc5624e7fdf744a342d3d8b73 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/api')
-rw-r--r-- | spec/lib/api/entities/ci/job_request/dependency_spec.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/lib/api/entities/ci/job_request/dependency_spec.rb b/spec/lib/api/entities/ci/job_request/dependency_spec.rb index fa5f3da554c..b45885e9982 100644 --- a/spec/lib/api/entities/ci/job_request/dependency_spec.rb +++ b/spec/lib/api/entities/ci/job_request/dependency_spec.rb @@ -3,8 +3,9 @@ require 'spec_helper' RSpec.describe API::Entities::Ci::JobRequest::Dependency do + let(:running_job) { create(:ci_build, :artifacts) } let(:job) { create(:ci_build, :artifacts) } - let(:entity) { described_class.new(job) } + let(:entity) { described_class.new(job, { running_job: running_job }) } subject { entity.as_json } @@ -16,8 +17,18 @@ RSpec.describe API::Entities::Ci::JobRequest::Dependency do expect(subject[:name]).to eq(job.name) end - it 'returns the dependency token' do - expect(subject[:token]).to eq(job.token) + it 'returns the token belonging to the running job' do + expect(subject[:token]).to eq(running_job.token) + end + + context 'when ci_expose_running_job_token_for_artifacts is disabled' do + before do + stub_feature_flags(ci_expose_running_job_token_for_artifacts: false) + end + + it 'returns the token belonging to the dependency job' do + expect(subject[:token]).to eq(job.token) + end end it 'returns the dependency artifacts_file', :aggregate_failures do |