demarches-normaliennes/spec/factories/avis.rb
Pierre de La Morinerie ec6ec6f4aa specs: improve avis factory
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.
2019-10-21 12:57:10 +02:00

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