Revert "Expose dossier PDF export as IO"
This commit is contained in:
parent
298c362e61
commit
362093eff0
7 changed files with 18 additions and 37 deletions
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue