link children tdc by ProcedureRevisionTypeDeChamp

This commit is contained in:
simon lehericey 2022-05-04 14:17:23 +02:00
parent ce0a592f3c
commit 64175db4dd

View file

@ -188,8 +188,17 @@ FactoryBot.define do
end
trait :with_types_de_champ do
after(:build) do |type_de_champ, _evaluator|
build(:type_de_champ, libelle: 'sub type de champ', parent: type_de_champ)
after(:build) do |type_de_champ, evaluator|
tdc = build(:type_de_champ, libelle: 'sub type de champ', parent: type_de_champ)
evaluator.procedure.save
ProcedureRevisionTypeDeChamp.create!(
revision_id: evaluator.procedure.active_revision.id,
type_de_champ_id: tdc.id,
parent_id: tdc.parent.revision_type_de_champ.id,
position: 0
)
end
end
end