Merge pull request #6286 from betagouv/6207-fix-archives-update-dossiers
archives: ne met pas à jour un dossier après la génération de l'export pdf par un instructeur
This commit is contained in:
commit
7bda735720
2 changed files with 17 additions and 1 deletions
|
@ -56,7 +56,9 @@ class PiecesJustificativesService
|
|||
include_infos_administration: true,
|
||||
dossier: dossier
|
||||
})
|
||||
dossier.pdf_export_for_instructeur.attach(io: StringIO.open(pdf), filename: "export-#{dossier.id}.pdf", content_type: 'application/pdf')
|
||||
ActiveRecord::Base.no_touching do
|
||||
dossier.pdf_export_for_instructeur.attach(io: StringIO.open(pdf), filename: "export-#{dossier.id}.pdf", content_type: 'application/pdf')
|
||||
end
|
||||
dossier.pdf_export_for_instructeur
|
||||
end
|
||||
|
||||
|
|
|
@ -44,4 +44,18 @@ describe PiecesJustificativesService do
|
|||
expect(subject.any? { |piece| piece.name == 'serialized' }).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe '.generate_dossier_export' do
|
||||
subject { PiecesJustificativesService.generate_dossier_export(dossier) }
|
||||
it "generates pdf export for instructeur" do
|
||||
subject
|
||||
expect(dossier.pdf_export_for_instructeur).to be_attached
|
||||
end
|
||||
|
||||
it "doesn't update dossier" do
|
||||
before_export = Time.zone.now
|
||||
subject
|
||||
expect(dossier.updated_at).to be <= before_export
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue