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