Revert "Expose dossier PDF export as IO"

This commit is contained in:
krichtof 2021-06-24 19:21:37 +02:00 committed by GitHub
parent 298c362e61
commit 362093eff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 37 deletions

View file

@ -201,6 +201,15 @@ FactoryBot.define do
end
end
trait :with_pdf_export do
after(:create) do |dossier, _evaluator|
dossier.pdf_export_for_instructeur.attach(
io: StringIO.new('Hello World'),
filename: 'export.pdf'
)
end
end
trait :with_justificatif do
after(:create) do |dossier, _evaluator|
dossier.justificatif_motivation.attach(

View file

@ -1,12 +1,12 @@
describe ActiveStorage::DownloadableFile do
let(:dossier) { create(:dossier, :en_construction) }
let(:dossier) { create(:dossier, :en_construction, :with_pdf_export) }
subject(:list) { ActiveStorage::DownloadableFile.create_list_from_dossier(dossier) }
describe 'create_list_from_dossier' do
context 'when no piece_justificative is present' do
it { expect(list.length).to eq 1 }
it { expect(list.first[0].name).to eq "pdf_export_for_instructeur" }
it { expect(list.first[0].record_type).to eq "Dossier" }
end
context 'when there is a piece_justificative' do

View file

@ -49,6 +49,7 @@ describe PiecesJustificativesService 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