2019-01-10 01:30:33 +08:00
|
|
|
# frozen_string_literal: true
|
2017-07-28 16:14:50 +08:00
|
|
|
|
2019-01-10 01:30:33 +08:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :experiment, class: Experiment do
|
|
|
|
transient do
|
|
|
|
user { create :user }
|
|
|
|
end
|
|
|
|
sequence(:name) { |n| "Experiment-#{n}" }
|
|
|
|
description { Faker::Lorem.sentence }
|
|
|
|
last_modified_by { user }
|
|
|
|
project { create :project, created_by: user }
|
2022-03-09 21:12:16 +08:00
|
|
|
created_by { project.created_by }
|
2019-03-13 16:06:48 +08:00
|
|
|
trait :with_tasks do
|
2019-01-10 01:30:33 +08:00
|
|
|
after(:create) do |e|
|
2021-09-30 17:32:11 +08:00
|
|
|
create_list :my_module, 3, :with_tag, experiment: e, created_by: e.created_by
|
2019-01-10 01:30:33 +08:00
|
|
|
end
|
|
|
|
end
|
2021-01-08 19:25:28 +08:00
|
|
|
|
|
|
|
trait :archived do
|
|
|
|
archived { true }
|
|
|
|
archived_on { Time.zone.now }
|
|
|
|
archived_by { created_by }
|
|
|
|
end
|
2017-07-28 16:14:50 +08:00
|
|
|
end
|
|
|
|
end
|