2016-02-08 18:16:18 +01:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :invite do
|
|
|
|
email 'plop@octo.com'
|
|
|
|
|
|
|
|
after(:build) do |invite, _evaluator|
|
|
|
|
if invite.dossier.nil?
|
|
|
|
invite.dossier = create(:dossier)
|
|
|
|
end
|
2017-01-04 18:03:03 +01:00
|
|
|
|
|
|
|
unless invite.user.nil?
|
|
|
|
invite.email = invite.user.email
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
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
|