diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 47a443dfb..d3a77ed5b 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -295,7 +295,7 @@ def dossier_factory_create_champ_or_repetition(type_de_champ, dossier) types_de_champ = dossier.revision.children_of(type_de_champ) 2.times do row_id = ULID.generate - type_de_champ.build_champ(dossier:, row_id:).save! + dossier.champs << type_de_champ.build_champ(row_id:) types_de_champ.each do |type_de_champ| dossier_factory_create_champ(type_de_champ, dossier, row_id:) end @@ -313,6 +313,6 @@ def dossier_factory_create_champ(type_de_champ, dossier, row_id: nil) elsif type_de_champ.multiple_drop_down_list? type_de_champ.drop_down_options.first(2).to_json end - attrs = { stable_id: type_de_champ.stable_id, private: type_de_champ.private?, row_id:, dossier:, value: }.compact - create(:"champ_do_not_use_#{type_de_champ.type_champ}", **attrs) + attrs = { stable_id: type_de_champ.stable_id, private: type_de_champ.private?, row_id:, value: }.compact + dossier.champs << build(:"champ_do_not_use_#{type_de_champ.type_champ}", **attrs) end