From c470cca9ab06f83a097ad33b07ac95b4d7df4de0 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2023 14:58:26 +0100 Subject: [PATCH] correctif(export.zip): integre les avis dans l'export au format pdf du dossier --- app/services/procedure_export_service.rb | 2 +- spec/services/procedure_export_service_spec.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/services/procedure_export_service.rb b/app/services/procedure_export_service.rb index ee24e574c..04a8c44fb 100644 --- a/app/services/procedure_export_service.rb +++ b/app/services/procedure_export_service.rb @@ -35,7 +35,7 @@ class ProcedureExportService end def to_zip - attachments = ActiveStorage::DownloadableFile.create_list_from_dossiers(dossiers, with_champs_private: true) + attachments = ActiveStorage::DownloadableFile.create_list_from_dossiers(dossiers, with_champs_private: true, include_infos_administration: true) DownloadableFileService.download_and_zip(procedure, attachments, base_filename) do |zip_filepath| ArchiveUploader.new(procedure: procedure, filename: filename(:zip), filepath: zip_filepath).blob diff --git a/spec/services/procedure_export_service_spec.rb b/spec/services/procedure_export_service_spec.rb index ba5701ee3..f25f27910 100644 --- a/spec/services/procedure_export_service_spec.rb +++ b/spec/services/procedure_export_service_spec.rb @@ -475,10 +475,16 @@ describe ProcedureExportService do end end + context 'generate_dossier_export' do + it 'include_infos_administration (so it includes avis, champs privés)' do + expect(ActiveStorage::DownloadableFile).to receive(:create_list_from_dossiers).with(anything, with_champs_private: true, include_infos_administration: true).and_return([]) + subject + end + end + context 'with files (and http calls)' do let!(:dossier) { create(:dossier, :accepte, :with_populated_champs, :with_individual, procedure: procedure) } let(:dossier_exports) { PiecesJustificativesService.generate_dossier_export(Dossier.where(id: dossier)) } - before do allow_any_instance_of(ActiveStorage::Attachment).to receive(:url).and_return("https://opengraph.githubassets.com/d0e7862b24d8026a3c03516d865b28151eb3859029c6c6c2e86605891fbdcd7a/socketry/async-io") end