demarches-normaliennes/spec/factories/avis.rb
2019-08-12 13:47:01 +02:00

27 lines
681 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FactoryBot.define do
factory :avis do
introduction { 'Bonjour, merci de me donner votre avis sur ce dossier' }
before(:create) do |avis, _evaluator|
if !avis.instructeur
avis.instructeur = create :instructeur
end
end
before(:create) do |avis, _evaluator|
if !avis.dossier
avis.dossier = create :dossier
end
end
before(:create) do |avis, _evaluator|
if !avis.claimant
avis.claimant = create :instructeur
end
end
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