demarches-normaliennes/spec/factories/invite.rb
2024-08-22 09:26:48 +02:00

20 lines
386 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :invite do
email { 'plop@octo.com' }
user { nil }
association :dossier
message { "un message d'invitation" }
after(:build) do |invite, _evaluator|
if invite.user.present?
invite.email = invite.user.email
end
end
trait :with_user do
association :user
end
end
end