add pdf to pjs export

This commit is contained in:
Christophe Robillard 2021-03-08 11:35:20 +01:00
parent e90957dd32
commit 60cc4d3697
6 changed files with 32 additions and 10 deletions

View file

@ -1,11 +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).to match([]) }
it { expect(list.length).to eq 1 }
it { expect(list.first[0].record_type).to eq "Dossier" }
end
context 'when there is a piece_justificative' do
@ -13,7 +14,7 @@ describe ActiveStorage::DownloadableFile do
dossier.champs << create(:champ_piece_justificative, :with_piece_justificative_file, dossier: dossier)
end
it { expect(list.length).to eq 1 }
it { expect(list.length).to eq 2 }
end
context 'when there is a private piece_justificative' do
@ -21,7 +22,7 @@ describe ActiveStorage::DownloadableFile do
dossier.champs_private << create(:champ_piece_justificative, :with_piece_justificative_file, private: true, dossier: dossier)
end
it { expect(list.length).to eq 1 }
it { expect(list.length).to eq 2 }
end
context 'when there is a repetition bloc' do
@ -30,7 +31,7 @@ describe ActiveStorage::DownloadableFile do
end
it 'should have 4 piece_justificatives' do
expect(list.size).to eq 4
expect(list.size).to eq 5
end
end
@ -39,7 +40,7 @@ describe ActiveStorage::DownloadableFile do
dossier.commentaires << create(:commentaire, dossier: dossier)
end
it { expect(list.length).to eq 0 }
it { expect(list.length).to eq 1 }
end
context 'when there is a message with an attachment' do
@ -47,7 +48,7 @@ describe ActiveStorage::DownloadableFile do
dossier.commentaires << create(:commentaire, :with_file, dossier: dossier)
end
it { expect(list.length).to eq 1 }
it { expect(list.length).to eq 2 }
end
end
end