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:
Diffstat (limited to 'spec/models/ml/experiment_spec.rb')
-rw-r--r--spec/models/ml/experiment_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/ml/experiment_spec.rb b/spec/models/ml/experiment_spec.rb
index 9738a88b5b8..1ee35d6da03 100644
--- a/spec/models/ml/experiment_spec.rb
+++ b/spec/models/ml/experiment_spec.rb
@@ -14,6 +14,21 @@ RSpec.describe Ml::Experiment, feature_category: :mlops do
it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:candidates) }
it { is_expected.to have_many(:metadata) }
+ it { is_expected.to belong_to(:model).class_name('Ml::Model') }
+ end
+
+ describe '#destroy' do
+ it 'allow experiment without model to be destroyed' do
+ experiment = create(:ml_experiments, project: exp.project)
+
+ expect { experiment.destroy! }.to change { Ml::Experiment.count }.by(-1)
+ end
+
+ it 'throws error when destroying experiment with model' do
+ experiment = create(:ml_models, project: exp.project).default_experiment
+
+ expect { experiment.destroy! }.to raise_error(ActiveRecord::ActiveRecordError)
+ end
end
describe '.package_name' do