dossier: add link to attestation when accepted
This commit is contained in:
parent
fd7f07a244
commit
27727eabf3
3 changed files with 17 additions and 0 deletions
|
@ -38,6 +38,9 @@
|
|||
%h3 Motif de l’acceptation
|
||||
%blockquote= dossier.motivation
|
||||
|
||||
- if dossier.attestation.present?
|
||||
= link_to 'Télécharger l’attestation', attestation_dossier_path(dossier), target: '_blank', class: 'button primary'
|
||||
|
||||
- elsif dossier.refuse?
|
||||
.refuse
|
||||
%p
|
||||
|
|
|
@ -136,5 +136,14 @@ FactoryBot.define do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_attestation do
|
||||
after(:create) do |dossier, _evaluator|
|
||||
if dossier.procedure.attestation_template.blank?
|
||||
dossier.procedure.attestation_template = create(:attestation_template)
|
||||
end
|
||||
dossier.attestation = dossier.build_attestation
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,6 +67,11 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
|
|||
it { is_expected.not_to have_selector('.status-timeline') }
|
||||
it { is_expected.to have_selector('.status-explanation .accepte') }
|
||||
it { is_expected.to have_text(dossier.motivation) }
|
||||
|
||||
context 'with attestation' do
|
||||
let(:dossier) { create :dossier, :accepte, :with_attestation }
|
||||
it { is_expected.to have_link(nil, href: attestation_dossier_path(dossier)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when refusé' do
|
||||
|
|
Loading…
Reference in a new issue