Merge pull request #2347 from betagouv/remove-show-route-hack

Supprime un hack sur les URLs "DossiersController#show"
This commit is contained in:
Paul Chavard 2018-08-07 13:33:42 +02:00 committed by GitHub
commit d1613b4af1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View file

@ -4,7 +4,7 @@
- if apercu
- form_options = { url: '', method: :get, html: { class: 'form', multipart: true } }
- else
- form_options = { html: { class: 'form', multipart: true, novalidate: dossier.brouillon? } }
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true, novalidate: dossier.brouillon? } }
= form_for dossier, form_options do |f|

View file

@ -243,6 +243,7 @@ Rails.application.routes.draw do
get 'identite'
patch 'update_identite'
get 'modifier'
patch 'modifier', to: 'dossiers#update'
get 'merci'
post 'ask_deletion'
get 'attestation'
@ -250,9 +251,6 @@ Rails.application.routes.draw do
collection do
post 'recherche'
# FIXME: to remove when show is implemeted
# needed to fix refresh after dossier draft save
get ':id', to: redirect('/dossiers/%{id}/modifier')
end
end
end

View file

@ -96,12 +96,12 @@ feature 'The user' do
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))
expect(page).to have_current_path(modifier_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))
expect(page).to have_current_path(modifier_dossier_path(user_dossier))
# Check a dossier can be submitted when all mandatory fields are filled
fill_in('texte obligatoire', with: 'super texte')