layouts: use a common procedure_context layout for the demarche overview

This commit is contained in:
Pierre de La Morinerie 2019-01-07 11:17:11 +00:00
parent 5a36546485
commit e25bd7139f
11 changed files with 106 additions and 81 deletions

View file

@ -0,0 +1,28 @@
require 'rails_helper'
describe 'layouts/procedure_context.html.haml', type: :view do
let(:procedure) { create(:simple_procedure, :with_service) }
let(:dossier) { create(:dossier, procedure: procedure) }
before do
assign(:dossier, dossier)
end
subject do
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
end
it 'renders a description of the procedure' do
expect(subject).to have_text(dossier.procedure.libelle)
expect(subject).to have_text(dossier.procedure.description)
end
it 'renders the inner content' do
expect(subject).to have_text('Column content')
end
it 'renders the dossier footer' do
expect(subject).to have_text(dossier.procedure.service.nom)
expect(subject).to have_text(dossier.procedure.service.email)
end
end

View file

@ -1,25 +1,26 @@
require 'spec_helper'
describe 'new_user/dossiers/identite.html.haml', type: :view do
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: create(:procedure, :with_two_type_de_piece_justificative, for_individual: true)) }
let(:footer) { view.content_for(:footer) }
let(:procedure) { create(:simple_procedure, for_individual: true) }
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
before do
sign_in dossier.user
assign(:dossier, dossier)
end
context 'test de composition de la page' do
before do
render
end
subject! { render }
it 'affiche les informations de la démarche' do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'has identity fields' do
expect(rendered).to have_field('Prénom')
expect(rendered).to have_field('Nom')
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
context 'when the demarche asks for the birthdate' do
let(:procedure) { create(:simple_procedure, for_individual: true, ask_birthday: true) }
it 'has a birthday field' do
expect(rendered).to have_field('Date de naissance')
end
end
end

View file

@ -2,7 +2,6 @@ require 'spec_helper'
describe 'new_user/dossiers/siret.html.haml', type: :view do
let(:dossier) { create(:dossier) }
let(:footer) { view.content_for(:footer) }
before do
sign_in dossier.user
@ -11,15 +10,7 @@ describe 'new_user/dossiers/siret.html.haml', type: :view do
subject! { render }
it 'affiche les informations de la démarche' do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'affiche le formulaire de SIRET' do
expect(rendered).to have_field('Numéro SIRET')
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
end
end