debian-mirror-gitlab/spec/models/ml/candidate_metric_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
676 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Ml::CandidateMetric do
describe 'associations' do
it { is_expected.to belong_to(:candidate) }
end
2023-01-13 00:05:48 +05:30
describe 'scope :latest' do
let_it_be(:candidate) { create(:ml_candidates) }
let!(:metric1) { create(:ml_candidate_metrics, candidate: candidate) }
let!(:metric2) { create(:ml_candidate_metrics, candidate: candidate ) }
let!(:metric3) { create(:ml_candidate_metrics, name: metric1.name, candidate: candidate) }
subject { described_class.latest }
it 'fetches only the last metric for the name' do
expect(subject).to match_array([metric2, metric3] )
end
end
2022-08-27 11:52:29 +05:30
end