Merge pull request #253 from sgmap/fix-105

[Fix #105] Show the pieces justificative’ descriptions
This commit is contained in:
gregoirenovel 2017-05-09 14:35:54 +02:00 committed by GitHub
commit 9e86f7934b
3 changed files with 45 additions and 0 deletions

View file

@ -138,3 +138,11 @@
width: 160px;
}
}
.piece-description {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373;
font-weight: normal;
}

View file

@ -22,6 +22,8 @@
%tr
%th.piece-libelle
= tpj.mandatory ? tpj.libelle + ' *' : tpj.libelle
%br
.piece-description= tpj.description
%td
- unless tpj.lien_demarche.blank?

View file

@ -0,0 +1,35 @@
require 'spec_helper'
describe 'users/description/_pieces_justificatives.html.haml', type: :view do
let!(:procedure) { create(:procedure) }
let!(:tpj1) { create(:type_de_piece_justificative,
procedure: procedure,
libelle: "Première pièce jointe",
description: "Première description",
order_place: 1,
mandatory: true
)}
let!(:tpj2) { create(:type_de_piece_justificative,
procedure: procedure,
libelle: "Seconde pièce jointe",
description: "Seconde description",
order_place: 2,
lien_demarche: "https://www.google.fr"
)}
let!(:dossier) { create(:dossier, :procedure => procedure) }
before do
render 'users/description/pieces_justificatives.html.haml', dossier: dossier
end
it 'should render two PJ with their title, mandatory status and description' do
expect(rendered).to include("Première pièce jointe *")
expect(rendered).to include("Seconde pièce jointe")
expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe")
expect(rendered).to include("Première description")
expect(rendered).to include("Seconde description")
expect(rendered).to have_selector("input[type=file]", count: 2)
end
end