Merge pull request #9558 from mfo/US/avis-in-exports
amelioration(dossier.export): ajoute les piece justificative des avis dans les exports
This commit is contained in:
commit
def659e599
3 changed files with 71 additions and 4 deletions
|
@ -2,10 +2,11 @@ describe PiecesJustificativesService do
|
|||
describe '.liste_documents' do
|
||||
let(:with_champs_private) { true }
|
||||
let(:with_bills) { true }
|
||||
let(:with_avis_piece_justificative) { true }
|
||||
|
||||
subject do
|
||||
PiecesJustificativesService
|
||||
.liste_documents(Dossier.where(id: dossier.id), with_bills:, with_champs_private:)
|
||||
.liste_documents(Dossier.where(id: dossier.id), with_bills:, with_champs_private:, with_avis_piece_justificative:)
|
||||
.map(&:first)
|
||||
end
|
||||
|
||||
|
@ -67,6 +68,50 @@ describe PiecesJustificativesService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with avis.piece_justificative being confidentiel' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:avis) { create(:avis, dossier: dossier, confidentiel: true) }
|
||||
let(:with_avis_piece_justificative) { false }
|
||||
|
||||
before do
|
||||
to_be_attached = {
|
||||
io: StringIO.new("toto"),
|
||||
filename: "toto.png",
|
||||
content_type: "image/png",
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
}
|
||||
|
||||
avis.piece_justificative_file.attach(to_be_attached)
|
||||
end
|
||||
|
||||
it "doesn't return confidentiel avis.piece_justificative_file" do
|
||||
expect(subject).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'with avis.piece_justificative being public' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:avis) { create(:avis, dossier: dossier) }
|
||||
let(:with_avis_piece_justificative) { false }
|
||||
|
||||
before do
|
||||
to_be_attached = {
|
||||
io: StringIO.new("toto"),
|
||||
filename: "toto.png",
|
||||
content_type: "image/png",
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
}
|
||||
|
||||
avis.piece_justificative_file.attach(to_be_attached)
|
||||
end
|
||||
|
||||
it "return avis.piece_justificative_file not confidentiel" do
|
||||
expect(subject).not_to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a identite champ pj' do
|
||||
let(:procedure) { create(:procedure, :with_titre_identite) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue