scinote-web/spec/factories/my_modules.rb

31 lines
837 B
Ruby
Raw Normal View History

2019-01-10 01:30:33 +08:00
# frozen_string_literal: true
FactoryBot.define do
2017-07-28 16:14:50 +08:00
factory :my_module do
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
created_by { experiment.created_by }
2019-01-10 01:30:33 +08:00
my_module_group { create :my_module_group, experiment: experiment }
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
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