models: require belong_to associations on type_de_champ

- Make `type_de_champ.procedure` a requirement;
- Move the procedure_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
This commit is contained in:
Pierre de La Morinerie 2020-07-20 17:20:44 +02:00
parent 6328011f60
commit 5a7bd24fba
3 changed files with 6 additions and 4 deletions

View file

@ -7,6 +7,8 @@ FactoryBot.define do
mandatory { false }
add_attribute(:private) { false }
association :procedure
factory :type_de_champ_text do
type_champ { TypeDeChamp.type_champs.fetch(:text) }
end