Merge pull request #9282 from colinux/fix-description-notice

Fix: pas de crash pour afficher le lien de la notice de la démarche
This commit is contained in:
Colin Darie 2023-07-06 14:08:15 +00:00 committed by GitHub
commit 34e074ff46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -1,4 +1,4 @@
- if link?
= link_to url, t(".name"), class: "fr-download__link", title: new_tab_suffix(t(".name")), **external_link_attributes
- elsif attachment?
= render Dsfr::DownloadComponent.new(attachment:, name: t(".name"), ephemeral_link: administrateur_signed_in?)
= render Dsfr::DownloadComponent.new(attachment:, name: t(".name"), ephemeral_link: helpers.administrateur_signed_in?)

View file

@ -34,6 +34,18 @@ describe 'shared/_procedure_description', type: :view do
end
end
context 'when procedure has notice' do
let(:procedure) { create(:procedure, :published, :with_notice) }
before do
allow(view).to receive(:administrateur_signed_in?).and_return(false)
end
it 'shows a link to the notice' do
subject
expect(rendered).to have_link("Télécharger le guide de la démarche")
end
end
context 'when the procedure has pieces jointes' do
let(:procedure) { create(:procedure, :draft, :with_titre_identite, :with_piece_justificative, :with_siret) }
it 'shows the pieces jointes list for draft procedure' do