feat(gallery): add attachments from justificatif motivation

This commit is contained in:
Eric Leroy-Terquem 2024-10-10 11:17:02 +02:00
parent 17aaa7b32c
commit efef61c34c
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
5 changed files with 35 additions and 4 deletions

View file

@ -145,6 +145,20 @@ RSpec.describe Attachment::GalleryItemComponent, type: :component do
end
end
context "when attachment is from a justificatif motivation" do
let(:fake_justificatif) { fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf') }
let(:attachment) { dossier.justificatif_motivation.attachment }
before { dossier.update!(justificatif_motivation: fake_justificatif) }
it "displays a generic libelle, link, tag and renders title" do
expect(subject).to have_text('Justificatif de décision')
expect(subject).to have_link(filename)
expect(subject).to have_text('Pièce jointe à la décision')
expect(component.title).to eq("Pièce jointe à la décision -- #{filename}")
end
end
context "when attachment is from an avis" do
context 'from an instructeur' do
let(:avis) { create(:avis, :with_introduction, dossier: dossier) }