2017-05-05 12:36:33 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'users/description/_pieces_justificatives.html.haml', type: :view do
|
|
|
|
let!(:procedure) { create(:procedure) }
|
2018-01-15 19:29:44 +01:00
|
|
|
let!(:tpj1) do
|
|
|
|
create(
|
|
|
|
:type_de_piece_justificative,
|
2017-06-12 14:10:49 +02:00
|
|
|
procedure: procedure,
|
|
|
|
libelle: "Première pièce jointe",
|
|
|
|
description: "Première description",
|
|
|
|
order_place: 1,
|
|
|
|
mandatory: true
|
|
|
|
)
|
2018-01-15 19:29:44 +01:00
|
|
|
end
|
|
|
|
let!(:tpj2) do
|
|
|
|
create(
|
|
|
|
:type_de_piece_justificative,
|
2017-06-12 14:10:49 +02:00
|
|
|
procedure: procedure,
|
|
|
|
libelle: "Seconde pièce jointe",
|
|
|
|
description: "Seconde description",
|
|
|
|
order_place: 2,
|
|
|
|
lien_demarche: "https://www.google.fr"
|
|
|
|
)
|
2018-01-15 19:29:44 +01:00
|
|
|
end
|
2017-05-05 12:36:33 +02:00
|
|
|
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")
|
|
|
|
|
2017-05-05 12:37:11 +02:00
|
|
|
expect(rendered).to include("Première description")
|
|
|
|
expect(rendered).to include("Seconde description")
|
|
|
|
|
2017-05-05 12:36:33 +02:00
|
|
|
expect(rendered).to have_selector("input[type=file]", count: 2)
|
|
|
|
end
|
|
|
|
end
|