|
72 | 72 | it_behaves_like 'the user can create a new draft' |
73 | 73 | end |
74 | 74 |
|
| 75 | + context 'when user is connected via France Connect with incomplete identity' do |
| 76 | + let(:procedure) { create(:procedure, :published, :for_individual, :with_service, libelle:) } |
| 77 | + let(:user) { create(:user, france_connect_informations: [build(:france_connect_information, family_name: nil)]) } |
| 78 | + |
| 79 | + it 'allows the user to fill in missing fields and edit them later' do |
| 80 | + find('label', text: "Pour vous").click |
| 81 | + |
| 82 | + expect(page).to have_field('Prénom', disabled: false) |
| 83 | + expect(page).to have_field('Nom', disabled: false) |
| 84 | + expect(page).not_to have_text("par FranceConnect et ne peuvent pas être modifiées") |
| 85 | + |
| 86 | + fill_in('Prénom', with: 'prenom') |
| 87 | + fill_in('Nom', with: 'nom') |
| 88 | + |
| 89 | + within "#identite-form" do |
| 90 | + click_button('Continuer') |
| 91 | + end |
| 92 | + |
| 93 | + dossier = procedure.dossiers.last |
| 94 | + expect(page).to have_current_path(brouillon_dossier_path(dossier)) |
| 95 | + expect(dossier.individual.reload.prenom).to eq('prenom') |
| 96 | + expect(dossier.individual.nom).to eq('nom') |
| 97 | + |
| 98 | + # Return to identity page to verify values are preserved |
| 99 | + visit identite_dossier_path(dossier) |
| 100 | + |
| 101 | + expect(page).to have_field('Prénom', with: 'prenom', disabled: false) |
| 102 | + expect(page).to have_field('Nom', with: 'nom', disabled: false) |
| 103 | + end |
| 104 | + end |
| 105 | + |
75 | 106 | context 'when for tiers is disabled' do |
76 | 107 | let(:procedure) { create(:procedure, :published, :for_individual, :with_service, for_tiers_enabled: false, libelle:) } |
77 | 108 |
|
|
0 commit comments