factories: mark the parent procedure as for_individual
This ensures that we don't get an inconsistency, where a dossier is `for_individual` while its procedure is not `for_individual`.
This commit is contained in:
parent
6a47458112
commit
00e5b736fb
1 changed files with 6 additions and 2 deletions
|
@ -37,9 +37,13 @@ FactoryBot.define do
|
|||
end
|
||||
|
||||
trait :for_individual do
|
||||
after(:build) do |dossier, _evaluator|
|
||||
after(:build) do |dossier, evaluator|
|
||||
# If the procedure was implicitely created by the factory,
|
||||
# mark it automatically as for_individual.
|
||||
if evaluator.procedure.nil?
|
||||
dossier.procedure.update(for_individual: true)
|
||||
end
|
||||
dossier.individual = create(:individual)
|
||||
dossier.save
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue