diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ml/model_version_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/ml/model_version_spec.rb b/spec/models/ml/model_version_spec.rb index 83639fca9e1..5daf8b3e5e4 100644 --- a/spec/models/ml/model_version_spec.rb +++ b/spec/models/ml/model_version_spec.rb @@ -116,6 +116,29 @@ RSpec.describe Ml::ModelVersion, feature_category: :mlops do end end + describe '#by_project_id_and_id' do + let(:id) { model_version1.id } + let(:project_id) { model_version1.project.id } + + subject { described_class.by_project_id_and_id(project_id, id) } + + context 'if exists' do + it { is_expected.to eq(model_version1) } + end + + context 'if id has no match' do + let(:id) { non_existing_record_id } + + it { is_expected.to be(nil) } + end + + context 'if project id does not match' do + let(:project_id) { non_existing_record_id } + + it { is_expected.to be(nil) } + end + end + describe '.order_by_model_id_id_desc' do subject { described_class.order_by_model_id_id_desc } |