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 Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /spec/models/ml/experiment_spec.rb
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/models/ml/experiment_spec.rb')
-rw-r--r--spec/models/ml/experiment_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/models/ml/experiment_spec.rb b/spec/models/ml/experiment_spec.rb
index dca5280a8fe..e300f82d290 100644
--- a/spec/models/ml/experiment_spec.rb
+++ b/spec/models/ml/experiment_spec.rb
@@ -8,4 +8,55 @@ RSpec.describe Ml::Experiment do
it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:candidates) }
end
+
+ describe '#by_project_id_and_iid?' do
+ let(:exp) { create(:ml_experiments) }
+ let(:iid) { exp.iid }
+
+ subject { described_class.by_project_id_and_iid(exp.project_id, iid) }
+
+ context 'if exists' do
+ it { is_expected.to eq(exp) }
+ end
+
+ context 'if does not exist' do
+ let(:iid) { non_existing_record_id }
+
+ it { is_expected.to be(nil) }
+ end
+ end
+
+ describe '#by_project_id_and_name?' do
+ let(:exp) { create(:ml_experiments) }
+ let(:exp_name) { exp.name }
+
+ subject { described_class.by_project_id_and_name(exp.project_id, exp_name) }
+
+ context 'if exists' do
+ it { is_expected.to eq(exp) }
+ end
+
+ context 'if does not exist' do
+ let(:exp_name) { 'hello' }
+
+ it { is_expected.to be_nil }
+ end
+ end
+
+ describe '#has_record?' do
+ let(:exp) { create(:ml_experiments) }
+ let(:exp_name) { exp.name }
+
+ subject { described_class.has_record?(exp.project_id, exp_name) }
+
+ context 'if exists' do
+ it { is_expected.to be_truthy }
+ end
+
+ context 'if does not exist' do
+ let(:exp_name) { 'hello' }
+
+ it { is_expected.to be_falsey }
+ end
+ end
end