summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-13 09:08:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-13 09:08:20 +0000
commit2d8c28f1d32709280506507f3b6e6d2da7440da9 (patch)
tree9ed8319e6cdddd1e03493b82c552ec8df590027f /spec/finders
parent99bb3eedd09ba55be5934da8138e2678a3e1be4d (diff)
downloadgitlab-ce-2d8c28f1d32709280506507f3b6e6d2da7440da9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/ci/jobs_finder_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/finders/ci/jobs_finder_spec.rb b/spec/finders/ci/jobs_finder_spec.rb
index 4c94aa4049b..0b3777a2fe8 100644
--- a/spec/finders/ci/jobs_finder_spec.rb
+++ b/spec/finders/ci/jobs_finder_spec.rb
@@ -99,6 +99,33 @@ RSpec.describe Ci::JobsFinder, '#execute' do
end
end
+ context 'when artifacts are present for some jobs' do
+ let_it_be(:job_with_artifacts) { create(:ci_build, :success, pipeline: pipeline, name: 'test') }
+ let_it_be(:artifact) { create(:ci_job_artifact, job: job_with_artifacts) }
+
+ subject { described_class.new(current_user: user, project: project, params: params).execute }
+
+ before do
+ project.add_maintainer(user)
+ end
+
+ context 'when with_artifacts is true' do
+ let(:params) { { with_artifacts: true } }
+
+ it 'returns only jobs with artifacts' do
+ expect(subject).to match_array([job_with_artifacts])
+ end
+ end
+
+ context 'when with_artifacts is false' do
+ let(:params) { { with_artifacts: false } }
+
+ it 'returns all jobs' do
+ expect(subject).to match_array([successful_job, job_with_artifacts])
+ end
+ end
+ end
+
context 'when pipeline is present' do
before_all do
project.add_maintainer(user)