From ec4083658933854023501e638db8742ba27455ab Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 8 Aug 2022 17:11:20 +0200 Subject: [PATCH] spec --- spec/system/users/brouillon_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec/system/users/brouillon_spec.rb b/spec/system/users/brouillon_spec.rb index 7bf1287a8..6d916a69b 100644 --- a/spec/system/users/brouillon_spec.rb +++ b/spec/system/users/brouillon_spec.rb @@ -269,6 +269,31 @@ describe 'The user' do context 'with condition' do include Logic + context 'with a required conditionnal champ' do + let(:procedure) do + procedure = create(:procedure, :published, :for_individual, + types_de_champ_public: [ + { type: :integer_number, libelle: 'age' }, + { type: :text, libelle: 'nom', mandatory: true } + ]) + + age, nom = procedure.draft_revision.types_de_champ.all + + nom.update(condition: greater_than_eq(champ_value(age.stable_id), constant(18))) + + procedure + end + + scenario 'submit a dossier with an hidden mandatory champ ', js: true do + log_in(user, procedure) + + fill_individual + + click_on 'Déposer le dossier' + expect(page).to have_current_path(merci_dossier_path(user_dossier)) + end + end + context 'with a visibilite in cascade' do let(:procedure) do procedure = create(:procedure, :for_individual).tap do |p|