ec6ec6f4aa
The instructeur, dossier and claimant where created regardless of wether they already existed or not. With this commit: - Associations are declarated in a more idiomatic way - They are correctly not created if they are provided when creating the object.
16 lines
492 B
Ruby
16 lines
492 B
Ruby
FactoryBot.define do
|
|
sequence(:expert_email) { |n| "expert#{n}@expert.com" }
|
|
|
|
factory :avis do
|
|
email { generate(:expert_email) }
|
|
introduction { 'Bonjour, merci de me donner votre avis sur ce dossier' }
|
|
confidentiel { false }
|
|
|
|
association :dossier
|
|
association :claimant, factory: :instructeur
|
|
|
|
trait :with_answer do
|
|
answer { "Mon avis se décompose en deux points :\n- La demande semble pertinente\n- Le demandeur remplit les conditions." }
|
|
end
|
|
end
|
|
end
|