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 - if @has_export_notification
%span.fr-ml-1v.notifications{ 'aria-label': t('instructeurs.dossiers.header.banner.exports_notification_label') } %span.fr-ml-1v.notifications{ 'aria-label': t('instructeurs.dossiers.header.banner.exports_notification_label') }
%li %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 %li
= link_to t('instructeurs.dossiers.header.banner.export_templates'), export_templates_instructeur_procedure_path(procedure), class: 'fr-nav__link' = 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') = t('views.instructeurs.dossiers.tab_explainations.suivis')
- if @statut == 'traites' - if @statut == 'traites'
%p %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' - if @statut == 'tous'
%p %p
- if @procedure.routing_enabled? - if @procedure.routing_enabled?

View file

@ -532,6 +532,13 @@ Rails.application.routes.draw do
end end
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 resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do
resource :contact_information resource :contact_information
member do member do

View file

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