Skip to content

Commit

Permalink
fix(dossier): add champs to dossiers in factories
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed Dec 10, 2024
1 parent e834854 commit e74287a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/factories/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit e74287a

Please sign in to comment.