2018-01-23 17:15:42 +01:00
|
|
|
FactoryBot.define do
|
2016-02-08 18:16:18 +01:00
|
|
|
factory :invite do
|
2018-09-04 16:46:48 +02:00
|
|
|
email { 'plop@octo.com' }
|
2020-07-20 16:56:23 +02:00
|
|
|
user { nil }
|
|
|
|
association :dossier
|
2023-12-14 12:51:56 +01:00
|
|
|
message { "un message d'invitation" }
|
2016-02-08 18:16:18 +01:00
|
|
|
|
|
|
|
after(:build) do |invite, _evaluator|
|
2018-01-11 19:04:39 +01:00
|
|
|
if invite.user.present?
|
2017-01-04 18:03:03 +01:00
|
|
|
invite.email = invite.user.email
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_user do
|
2020-07-20 16:56:23 +02:00
|
|
|
association :user
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|