From ecca3b3f372f7358b67bba9042af81b83a75ec2f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 12:36:33 +0200 Subject: [PATCH] Add a missing test for _pieces_justificatives.html.haml --- .../_pieces_justificatives.html.haml_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/views/users/description/_pieces_justificatives.html.haml_spec.rb diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb new file mode 100644 index 000000000..415f3acd6 --- /dev/null +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -0,0 +1,30 @@ +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", + order_place: 1, + mandatory: true + )} + let!(:tpj2) { create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Seconde pièce jointe", + 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 have_selector("input[type=file]", count: 2) + end +end