diff options
Diffstat (limited to 'spec/factories/ml/candidates.rb')
-rw-r--r-- | spec/factories/ml/candidates.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/factories/ml/candidates.rb b/spec/factories/ml/candidates.rb index 1b41e39d711..b9a2320138a 100644 --- a/spec/factories/ml/candidates.rb +++ b/spec/factories/ml/candidates.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true FactoryBot.define do factory :ml_candidates, class: '::Ml::Candidate' do - association :experiment, factory: :ml_experiments + association :project, factory: :project association :user + experiment { association :ml_experiments, project_id: project.id } + trait :with_metrics_and_params do after(:create) do |candidate| candidate.metrics = FactoryBot.create_list(:ml_candidate_metrics, 2, candidate: candidate ) @@ -19,10 +21,12 @@ FactoryBot.define do trait :with_artifact do after(:create) do |candidate| - FactoryBot.create(:generic_package, - name: candidate.package_name, - version: candidate.package_version, - project: candidate.project) + candidate.package = FactoryBot.create( + :generic_package, + name: candidate.package_name, + version: candidate.package_version, + project: candidate.project + ) end end end |