tech(review): add a guard clause to prevent missing pdf, enhance specs

This commit is contained in:
mfo 2024-04-02 09:53:11 +02:00
parent 2944a0c2c3
commit 3a895fbd4a
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
3 changed files with 59 additions and 32 deletions

View file

@ -20,7 +20,7 @@
- c.with_value do
= simple_format dossier.motivation
- if dossier.attestation.present?
- if dossier.attestation.present? && dossier.attestation.pdf.attached?
= render Dossiers::RowShowComponent.new(label: "Attestation") do |c|
- c.with_value do
= render Dsfr::DownloadComponent.new(attachment: dossier.attestation.pdf, name: t(:download_attestation, scope: [:views, :shared, :dossiers, :form]))