generate export with export_template

This commit is contained in:
Christophe Robillard 2024-03-08 17:14:21 +01:00 committed by simon lehericey
parent 7a39752630
commit 357c07456c
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
17 changed files with 131 additions and 48 deletions

View file

@ -936,7 +936,7 @@ describe Instructeurs::DossiersController, type: :controller do
subject
end
it { expect(assigns(:acls)).to eq(PiecesJustificativesService.new(user_profile: instructeur).acl_for_dossier_export(dossier.procedure)) }
it { expect(assigns(:acls)).to eq(PiecesJustificativesService.new(user_profile: instructeur, export_template: nil).acl_for_dossier_export(dossier.procedure)) }
it { expect(assigns(:is_dossier_in_batch_operation)).to eq(false) }
it { expect(response).to render_template 'dossiers/show' }

View file

@ -736,6 +736,18 @@ describe Instructeurs::ProceduresController, type: :controller do
end
it { expect { subject }.to change { Export.where(user_profile: instructeur).count }.by(1) }
context 'with an export template' do
let(:export_template) { create(:export_template) }
subject do
get :download_export, params: { export_template_id: export_template.id, procedure_id: procedure.id }
end
it 'displays an notice' do
is_expected.to redirect_to(exports_instructeur_procedure_url(procedure))
expect(flash.notice).to be_present
end
end
end
context 'when the export is not ready' do