diff --git a/app/views/shared/dossiers/_edit.html.haml b/app/views/shared/dossiers/_edit.html.haml
index c43012547..2c83362b3 100644
--- a/app/views/shared/dossiers/_edit.html.haml
+++ b/app/views/shared/dossiers/_edit.html.haml
@@ -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|
diff --git a/config/routes.rb b/config/routes.rb
index 663a9562f..ba3d88bb0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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
diff --git a/spec/features/new_user/dossier_spec.rb b/spec/features/new_user/dossier_spec.rb
index 4b8100e65..4859ed215 100644
--- a/spec/features/new_user/dossier_spec.rb
+++ b/spec/features/new_user/dossier_spec.rb
@@ -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')