From de0acc0a220f484a085d014aeb2bed97a27c0620 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 24 Dec 2015 15:22:30 +0100 Subject: [PATCH] Change URL for not found procedure --- app/controllers/users/dossiers_controller.rb | 4 +++- config/locales/fr.yml | 1 + spec/controllers/users/dossiers_controller_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 6433a58d9..541e60d34 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -156,6 +156,8 @@ class Users::DossiersController < UsersController end def error_procedure - render :file => "#{Rails.root}/public/404_procedure_not_found.html", :status => 404 + flash.alert = t('errors.messages.procedure_not_found') + + redirect_to url_for users_dossiers_path end end diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f6a6b4019..7fe018890 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -93,6 +93,7 @@ fr: dossier_not_found: "Le dossier n'existe pas ou vous n'y avez pas accès." dossier_map_not_activated: "Le dossier n'a pas accès à la cartographie." invalid_siret: "Le siret est incorrect" + procedure_not_found: "La procédure n'existe pas" france_connect: connexion: "Erreur lors de la connexion à France Connect." diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 91cd025af..4b3c36232 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -46,7 +46,7 @@ describe Users::DossiersController, type: :controller do context 'when procedure is archived' do let(:procedure) { create(:procedure, archived: 'true') } - it { is_expected.to have_http_status(404) } + it { is_expected.to redirect_to users_dossiers_path } end end context 'when user is not logged' do @@ -61,7 +61,7 @@ describe Users::DossiersController, type: :controller do sign_in create(:user) end - it { is_expected.to have_http_status(404) } + it { is_expected.to redirect_to users_dossiers_path } end end end