Merge pull request #6693 from betagouv/fix/6638

ETQ Instructeur, je veux voir les documents que j'ai joins à une demande d'avis
This commit is contained in:
Kara Diaby 2021-11-30 14:43:01 +01:00 committed by GitHub
commit a5751943b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 1 deletions

View file

@ -40,6 +40,11 @@
- if avis.revokable_by?(current_instructeur)
|
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
- if avis.introduction_file.attached?
= render partial: 'shared/attachment/show', locals: { attachment: avis.introduction_file.attachment }
.answer-body.mb-3
%p #{t('views.instructeurs.avis.introduction_file_explaination')} #{avis.claimant.email}
- if avis.piece_justificative_file.attached?
= render partial: 'shared/attachment/show', locals: { attachment: avis.piece_justificative_file.attachment }
.answer-body

View file

@ -135,6 +135,8 @@ en:
instructeurs:
dossiers:
deleted_by_user: "File deleted by user"
avis:
introduction_file_explaination: "File attached to the request for advice"
users:
dossiers:
autosave:

View file

@ -131,6 +131,8 @@ fr:
instructeurs:
dossiers:
deleted_by_user: "Dossier supprimé par l'usager"
avis:
introduction_file_explaination: "Fichier joint à la demande davis"
users:
dossiers:
autosave:

View file

@ -4,10 +4,12 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
subject { render 'instructeurs/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
let(:instructeur) { create(:instructeur) }
let(:instructeur2) { create(:instructeur) }
let(:introduction_file) { fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf') }
let(:expert) { create(:expert) }
let!(:dossier) { create(:dossier) }
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: dossier.procedure) }
let(:avis) { [create(:avis, claimant: instructeur, experts_procedure: experts_procedure)] }
let(:avis) { [create(:avis, claimant: instructeur, experts_procedure: experts_procedure, introduction_file: introduction_file)] }
let(:seen_at) { avis.first.created_at + 1.hour }
it { is_expected.to have_text(avis.first.introduction) }
@ -16,6 +18,7 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
context 'with a seen_at before avis created_at' do
let(:seen_at) { avis.first.created_at - 1.hour }
it { is_expected.to have_text("Fichier joint à la demande davis") }
it { is_expected.to have_css(".highlighted") }
end
@ -26,4 +29,12 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
expect(subject).to include(simple_format(avis.first.answer))
end
end
context 'with another instructeur' do
let(:avis) { [create(:avis, :with_answer, claimant: instructeur2, experts_procedure: experts_procedure, introduction_file: introduction_file)] }
it 'shows the files attached to the avis request' do
expect(subject).to have_text("Fichier joint à la demande davis")
end
end
end