From d70f01a6b27bf082f526bfe7719d7edc67414092 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 2 Jul 2018 12:27:01 +0200 Subject: [PATCH] form: cleanup dossier feature spec --- spec/features/new_user/dossier_spec.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/features/new_user/dossier_spec.rb b/spec/features/new_user/dossier_spec.rb index b9145ab37..26acaa12d 100644 --- a/spec/features/new_user/dossier_spec.rb +++ b/spec/features/new_user/dossier_spec.rb @@ -84,7 +84,7 @@ feature 'The user' do end let(:simple_procedure) do - tdcs = [create(:type_de_champ, mandatory: true, libelle: 'text')] + tdcs = [create(:type_de_champ, mandatory: true, libelle: 'texte obligatoire')] create(:procedure, :published, :for_individual, types_de_champ: tdcs) end @@ -92,19 +92,23 @@ feature 'The user' do log_in(user.email, password, simple_procedure) fill_individual + # Check an incomplete dossier can be saved as a draft, even when mandatory fields are missing click_on 'Enregistrer le brouillon' + expect(user_dossier.reload.brouillon?).to be(true) expect(page).to have_content('Votre brouillon a bien été sauvegardé') expect(page).to have_current_path(dossier_path(user_dossier)) + # Check an incomplete dossier cannot be submitted when mandatory fields are missing click_on 'Soumettre le dossier' expect(user_dossier.reload.brouillon?).to be(true) expect(page).to have_current_path(dossier_path(user_dossier)) - fill_in('text', with: 'super texte') + # Check a dossier can be submitted when all mandatory fields are filled + fill_in('texte obligatoire', with: 'super texte') click_on 'Soumettre le dossier' expect(user_dossier.reload.en_construction?).to be(true) - expect(champ_value_for('text')).to eq('super texte') + expect(champ_value_for('texte obligatoire')).to eq('super texte') expect(page).to have_current_path(merci_dossier_path(user_dossier)) end