fix(instructeurs/archives/routes): move archives routes under another url schema to avoid conflict with dossier archvied

This commit is contained in:
mfo 2024-11-20 11:35:25 +01:00
parent c260c43dac
commit e6d9ee93a6
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
4 changed files with 21 additions and 15 deletions

View file

@ -56,7 +56,7 @@
- if @has_export_notification
%span.fr-ml-1v.notifications{ 'aria-label': t('instructeurs.dossiers.header.banner.exports_notification_label') }
%li
= link_to t('instructeurs.dossiers.header.banner.archives'), instructeur_archives_path(procedure), class: 'fr-nav__link'
= link_to t('instructeurs.dossiers.header.banner.archives'), list_instructeur_archives_path(procedure), class: 'fr-nav__link'
%li
= link_to t('instructeurs.dossiers.header.banner.export_templates'), export_templates_instructeur_procedure_path(procedure), class: 'fr-nav__link'

View file

@ -30,7 +30,7 @@
= t('views.instructeurs.dossiers.tab_explainations.suivis')
- if @statut == 'traites'
%p
= t('views.instructeurs.dossiers.tab_explainations.traites_html', archives_path: instructeur_archives_path(@procedure))
= t('views.instructeurs.dossiers.tab_explainations.traites_html', archives_path: list_instructeur_archives_path(@procedure))
- if @statut == 'tous'
%p
- if @procedure.routing_enabled?

View file

@ -532,6 +532,13 @@ Rails.application.routes.draw do
end
end
resources :archives, only: [] do
collection do
get 'list' => "archives#index"
post 'create' => "archives#create"
end
end
resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do
resource :contact_information
member do

View file

@ -199,20 +199,19 @@ describe 'Instructing a dossier:', js: true do
expect(page).to have_text("Dossier envoyé")
end
context 'A instructeur can ask for an Archive' do
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
before do
scenario 'A instructeur can ask for an Archive', chrome: true do
archivable_procedure = create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur])
create(:dossier, :accepte, procedure: archivable_procedure)
log_in(instructeur.email, password)
visit instructeur_archives_path(procedure)
end
scenario 'download' do
visit list_instructeur_archives_path(archivable_procedure)
expect {
page.first(".fr-table .fr-btn").click
}.to have_enqueued_job(ArchiveCreationJob).with(procedure, an_instance_of(Archive), instructeur)
}.to have_enqueued_job(ArchiveCreationJob).with(archivable_procedure, an_instance_of(Archive), instructeur)
expect(Archive.first.month).not_to be_nil
end
end
context 'with dossiers having attached files' do
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }