2019-01-10 01:30:33 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-23 21:54:15 +08:00
|
|
|
FactoryBot.define do
|
2017-07-28 16:14:50 +08:00
|
|
|
factory :my_module do
|
2021-09-30 17:32:11 +08:00
|
|
|
transient do
|
|
|
|
user { create :user }
|
|
|
|
end
|
2019-01-10 01:30:33 +08:00
|
|
|
sequence(:name) { |n| "Task-#{n}" }
|
2019-09-16 15:31:30 +08:00
|
|
|
sequence(:y) { |n| n }
|
2020-06-15 16:20:10 +08:00
|
|
|
sequence(:x) { |n| n }
|
2019-01-11 17:16:50 +08:00
|
|
|
workflow_order { MyModule.where(experiment_id: experiment.id).count + 1 }
|
2019-01-10 01:30:33 +08:00
|
|
|
experiment
|
2022-03-09 21:12:16 +08:00
|
|
|
created_by { experiment.created_by }
|
2019-01-10 01:30:33 +08:00
|
|
|
my_module_group { create :my_module_group, experiment: experiment }
|
2019-01-15 20:45:05 +08:00
|
|
|
trait :with_tag do
|
|
|
|
tags { create_list :tag, 3, project: experiment.project }
|
|
|
|
end
|
2019-03-12 00:17:59 +08:00
|
|
|
trait :with_due_date do
|
2019-09-12 23:21:48 +08:00
|
|
|
due_date { Faker::Time.between(from: Date.today, to: Date.today + 10.days) }
|
2019-03-12 00:17:59 +08:00
|
|
|
end
|
2020-08-27 19:26:17 +08:00
|
|
|
trait :with_status do
|
|
|
|
my_module_status
|
|
|
|
end
|
2021-01-04 22:11:24 +08:00
|
|
|
trait :archived do
|
|
|
|
archived { true }
|
|
|
|
archived_on { Time.zone.now }
|
|
|
|
archived_by { create(:user) }
|
|
|
|
end
|
2017-07-28 16:14:50 +08:00
|
|
|
end
|
|
|
|
end
|