scinote-web/spec/factories/experiments.rb
aignatov-bio 7f7bf0533a
Fix tests [SCI-6486] (#3913)
* Fix tests [SCI-6486]

* Fix rspec tests [SCI-6486]

Co-authored-by: Anton <anton@scinote.net>
2022-03-09 14:12:16 +01:00

25 lines
647 B
Ruby

# frozen_string_literal: true
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 }
created_by { project.created_by }
trait :with_tasks do
after(:create) do |e|
create_list :my_module, 3, :with_tag, experiment: e, created_by: e.created_by
end
end
trait :archived do
archived { true }
archived_on { Time.zone.now }
archived_by { created_by }
end
end
end