factories: ensure that dossiers with_individual are consistent

This commit is contained in:
Pierre de La Morinerie 2020-01-07 17:45:39 +01:00
parent 724ff50363
commit 0efb62f03a
3 changed files with 6 additions and 2 deletions

View file

@ -43,6 +43,9 @@ FactoryBot.define do
if evaluator.procedure.nil?
dossier.procedure.update(for_individual: true)
end
if !dossier.procedure.for_individual?
raise 'Inconsistent factory: attempting to create a dossier :with_individual on a procedure that is not `for_individual?`'
end
dossier.individual = create(:individual)
end
end