2018-01-23 17:15:42 +01:00
|
|
|
FactoryBot.define do
|
2017-05-12 13:32:48 +02:00
|
|
|
factory :invite_user do
|
|
|
|
email 'plop@octo.com'
|
|
|
|
|
|
|
|
after(:build) do |invite, _evaluator|
|
|
|
|
if invite.dossier.nil?
|
|
|
|
invite.dossier = create(:dossier)
|
|
|
|
end
|
|
|
|
|
2018-01-11 19:04:39 +01:00
|
|
|
if invite.user.present?
|
2017-05-12 13:32:48 +02:00
|
|
|
invite.email = invite.user.email
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_user do
|
|
|
|
after(:build) do |invite, _evaluator|
|
|
|
|
if invite.user.nil?
|
|
|
|
invite.user = create(:user)
|
|
|
|
invite.email = invite.user.email
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|