demarches-normaliennes/spec/factories/invite_user.rb
2017-05-12 16:31:03 +02:00

24 lines
506 B
Ruby

FactoryGirl.define do
factory :invite_user do
email 'plop@octo.com'
after(:build) do |invite, _evaluator|
if invite.dossier.nil?
invite.dossier = create(:dossier)
end
unless invite.user.nil?
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