diff options
Diffstat (limited to 'spec/presenters/ml/candidate_details_presenter_spec.rb')
-rw-r--r-- | spec/presenters/ml/candidate_details_presenter_spec.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/presenters/ml/candidate_details_presenter_spec.rb b/spec/presenters/ml/candidate_details_presenter_spec.rb index 0ecf80b683e..34de1e66a8a 100644 --- a/spec/presenters/ml/candidate_details_presenter_spec.rb +++ b/spec/presenters/ml/candidate_details_presenter_spec.rb @@ -13,6 +13,8 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do let_it_be(:metrics) do [ build_stubbed(:ml_candidate_metrics, name: 'metric1', value: 0.1, candidate: candidate), + build_stubbed(:ml_candidate_metrics, name: 'metric1', value: 0.2, step: 1, candidate: candidate), + build_stubbed(:ml_candidate_metrics, name: 'metric1', value: 0.3, step: 2, candidate: candidate), build_stubbed(:ml_candidate_metrics, name: 'metric2', value: 0.2, candidate: candidate), build_stubbed(:ml_candidate_metrics, name: 'metric3', value: 0.3, candidate: candidate) ] @@ -30,7 +32,7 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do subject { Gitlab::Json.parse(described_class.new(candidate, include_ci_job).present)['candidate'] } before do - allow(candidate).to receive(:latest_metrics).and_return(metrics) + allow(candidate).to receive(:metrics).and_return(metrics) allow(candidate).to receive(:params).and_return(params) end @@ -45,9 +47,11 @@ RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do it 'generates the correct metrics' do expect(subject['metrics']).to include( - hash_including('name' => 'metric1', 'value' => 0.1), - hash_including('name' => 'metric2', 'value' => 0.2), - hash_including('name' => 'metric3', 'value' => 0.3) + hash_including('name' => 'metric1', 'value' => 0.1, 'step' => 0), + hash_including('name' => 'metric1', 'value' => 0.2, 'step' => 1), + hash_including('name' => 'metric1', 'value' => 0.3, 'step' => 2), + hash_including('name' => 'metric2', 'value' => 0.2, 'step' => 0), + hash_including('name' => 'metric3', 'value' => 0.3, 'step' => 0) ) end |