debian-mirror-gitlab/spec/factories/ml/candidates.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1,020 B
Ruby
Raw Normal View History

2022-10-11 01:57:18 +05:30
# frozen_string_literal: true
FactoryBot.define do
factory :ml_candidates, class: '::Ml::Candidate' do
2023-06-20 00:43:36 +05:30
association :project, factory: :project
2022-10-11 01:57:18 +05:30
association :user
2022-11-25 23:54:43 +05:30
2023-06-20 00:43:36 +05:30
experiment { association :ml_experiments, project_id: project.id }
2022-11-25 23:54:43 +05:30
trait :with_metrics_and_params do
after(:create) do |candidate|
candidate.metrics = FactoryBot.create_list(:ml_candidate_metrics, 2, candidate: candidate )
candidate.params = FactoryBot.create_list(:ml_candidate_params, 2, candidate: candidate )
end
end
2023-03-04 22:38:38 +05:30
trait :with_metadata do
after(:create) do |candidate|
candidate.metadata = FactoryBot.create_list(:ml_candidate_metadata, 2, candidate: candidate )
end
end
2023-03-17 16:20:25 +05:30
trait :with_artifact do
after(:create) do |candidate|
2023-07-09 08:55:56 +05:30
candidate.package = FactoryBot.create(
:generic_package,
name: candidate.package_name,
version: candidate.package_version,
project: candidate.project
)
2023-03-17 16:20:25 +05:30
end
end
2022-10-11 01:57:18 +05:30
end
end