scinote-web/spec/factories/experiments.rb

20 lines
482 B
Ruby
Raw Normal View History

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 }
created_by { user }
last_modified_by { user }
project { create :project, created_by: user }
2019-03-13 16:06:48 +08:00
trait :with_tasks do
2019-01-10 01:30:33 +08:00
after(:create) do |e|
create_list :my_module, 3, :with_tag, experiment: e
2019-01-10 01:30:33 +08:00
end
end
2017-07-28 16:14:50 +08:00
end
end