Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-09-28 18:25:30 +0300
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-09-28 18:25:30 +0300
commit8b7cfdd3397edb18f0e0d4f1c71d6b9282f68aef (patch)
treeda9f75c7a333910cc22842293a7a7b9b98101998 /spec/presenters/ml/candidate_details_presenter_spec.rb
parente11473abda8f2f224f77a066691dc90744ef0925 (diff)
parente6801ed8d4470b43705026fffb85e2a8248fbea8 (diff)
Merge remote-tracking branch 'dev/16-4-stable' into 16-4-stable
Diffstat (limited to 'spec/presenters/ml/candidate_details_presenter_spec.rb')
-rw-r--r--spec/presenters/ml/candidate_details_presenter_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/presenters/ml/candidate_details_presenter_spec.rb b/spec/presenters/ml/candidate_details_presenter_spec.rb
index 9d1f6f634e4..0ecf80b683e 100644
--- a/spec/presenters/ml/candidate_details_presenter_spec.rb
+++ b/spec/presenters/ml/candidate_details_presenter_spec.rb
@@ -25,7 +25,9 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do
]
end
- subject { Gitlab::Json.parse(described_class.new(candidate).present)['candidate'] }
+ let(:include_ci_job) { true }
+
+ subject { Gitlab::Json.parse(described_class.new(candidate, include_ci_job).present)['candidate'] }
before do
allow(candidate).to receive(:latest_metrics).and_return(metrics)
@@ -68,6 +70,8 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do
let_it_be(:pipeline) { build_stubbed(:ci_pipeline, project: project, user: user) }
let_it_be(:build) { candidate.ci_build = build_stubbed(:ci_build, pipeline: pipeline, user: user) }
+ let(:can_read_build) { true }
+
it 'generates the correct ci' do
expected_info = {
'path' => "/#{project.full_path}/-/jobs/#{build.id}",
@@ -109,6 +113,14 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do
expect(subject.dig('info', 'ci_job', 'merge_request')).to include(expected_info)
end
end
+
+ context 'when ci job is not to be added' do
+ let(:include_ci_job) { false }
+
+ it 'ci_job is nil' do
+ expect(subject.dig('info', 'ci_job')).to be_nil
+ end
+ end
end
end
end