diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
commit | 777ef5e9b2cb049db6c25867d8321a191cec8f72 (patch) | |
tree | 8e2458bdde3047bb367e99e9d7de9862107e6212 /spec/factories | |
parent | 6352d2f7c2a9e62e07f854861f9f57dacbd6f4a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/ml/candidates.rb | 17 | ||||
-rw-r--r-- | spec/factories/ml/models.rb | 4 |
2 files changed, 7 insertions, 14 deletions
diff --git a/spec/factories/ml/candidates.rb b/spec/factories/ml/candidates.rb index 9bfb78066bd..27b31524b1f 100644 --- a/spec/factories/ml/candidates.rb +++ b/spec/factories/ml/candidates.rb @@ -1,10 +1,9 @@ # frozen_string_literal: true FactoryBot.define do factory :ml_candidates, class: '::Ml::Candidate' do - association :project, factory: :project - association :user - - experiment { association :ml_experiments, project_id: project.id } + project { association :project } + user { project.owner } + experiment { association :ml_experiments, project_id: project.id, user: project.owner } trait :with_metrics_and_params do metrics { Array.new(2) { association(:ml_candidate_metrics, candidate: instance) } } @@ -16,13 +15,9 @@ FactoryBot.define do end trait :with_artifact do - after(:create) do |candidate| - candidate.package = FactoryBot.create( - :generic_package, - name: candidate.package_name, - version: candidate.package_version, - project: candidate.project - ) + artifact do + association(:generic_package, name: instance.package_name, version: instance.package_version || '1', + project: project) end end end diff --git a/spec/factories/ml/models.rb b/spec/factories/ml/models.rb index 3377a54f265..ae00ade9054 100644 --- a/spec/factories/ml/models.rb +++ b/spec/factories/ml/models.rb @@ -20,9 +20,7 @@ FactoryBot.define do end trait :with_metadata do - after(:create) do |model| - model.metadata = FactoryBot.create_list(:ml_model_metadata, 2, model: model) # rubocop:disable StrategyInCallback - end + metadata { Array.new(2) { association(:ml_model_metadata, model: instance) } } end end end |