Merge pull request #5580 from Keirua/remove-old-routes-admin-procedures

Redirections for deprecated procedure editor routes
This commit is contained in:
Keirua 2020-09-17 14:22:16 +02:00 committed by GitHub
commit fefcb3ba97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 24 deletions

View file

@ -17,28 +17,6 @@ class Admin::ProceduresController < AdminController
end
end
def archived
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.closes.order(published_at: :desc),
partial: "admin/procedures/list",
array: true
archived_class
render 'index'
end
def draft
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.brouillons.order(created_at: :desc),
partial: "admin/procedures/list",
array: true
draft_class
render 'index'
end
def show
if @procedure.brouillon?
@procedure_lien = commencer_test_url(path: @procedure.path)

View file

@ -174,8 +174,8 @@ Rails.application.routes.draw do
namespace :admin do
get 'activate' => '/administrateurs/activate#new'
patch 'activate' => '/administrateurs/activate#create'
get 'procedures/archived' => 'procedures#archived'
get 'procedures/draft' => 'procedures#draft'
get 'procedures/archived', to: redirect('/admin/procedures?statut=archivees')
get 'procedures/draft', to: redirect('/admin/procedures?statut=brouillons')
resources :procedures, only: [:destroy] do
collection do

View file

@ -18,6 +18,18 @@ feature 'Publication de démarches', js: true do
login_as administrateur.user, scope: :user
end
context "lorsqu'on essaie d'accéder au backoffice déprécié" do
scenario "on est redirigé pour les démarches brouillon" do
visit admin_procedures_draft_path
expect(page).to have_current_path(admin_procedures_path(statut: "brouillons"))
end
scenario "on est redirigé pour les démarches archivées" do
visit admin_procedures_archived_path
expect(page).to have_current_path(admin_procedures_path(statut: "archivees"))
end
end
context 'lorsquune démarche est en test' do
scenario 'un administrateur peut la publier' do
visit admin_procedures_path(statut: "brouillons")