2019-01-07 12:17:11 +01:00
|
|
|
describe 'layouts/procedure_context.html.haml', type: :view do
|
|
|
|
let(:procedure) { create(:simple_procedure, :with_service) }
|
|
|
|
let(:dossier) { create(:dossier, procedure: procedure) }
|
|
|
|
|
2019-08-08 17:36:08 +02:00
|
|
|
before do
|
|
|
|
allow(view).to receive(:instructeur_signed_in?).and_return(false)
|
2019-08-09 15:34:53 +02:00
|
|
|
allow(view).to receive(:administrateur_signed_in?).and_return(false)
|
2021-08-24 11:39:15 +02:00
|
|
|
allow(view).to receive(:localization_enabled?).and_return(false)
|
2019-08-08 17:36:08 +02:00
|
|
|
end
|
|
|
|
|
2019-01-07 12:17:11 +01:00
|
|
|
subject do
|
|
|
|
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
|
|
|
|
end
|
|
|
|
|
2019-01-08 08:30:39 +01:00
|
|
|
context 'when a procedure is assigned' do
|
|
|
|
before do
|
|
|
|
assign(:procedure, procedure)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders a description of the procedure' do
|
|
|
|
expect(subject).to have_text(procedure.libelle)
|
|
|
|
expect(subject).to have_text(procedure.description)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders the inner content' do
|
|
|
|
expect(subject).to have_text('Column content')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders the procedure footer' do
|
|
|
|
expect(subject).to have_text(procedure.service.nom)
|
|
|
|
expect(subject).to have_text(procedure.service.email)
|
|
|
|
end
|
2019-01-07 12:17:11 +01:00
|
|
|
end
|
|
|
|
|
2019-01-08 08:20:49 +01:00
|
|
|
context 'when a dossier is assigned' do
|
|
|
|
before do
|
|
|
|
assign(:dossier, dossier)
|
|
|
|
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 procedure footer' do
|
|
|
|
expect(subject).to have_text(dossier.procedure.service.nom)
|
|
|
|
expect(subject).to have_text(dossier.procedure.service.email)
|
|
|
|
end
|
2019-01-07 12:17:11 +01:00
|
|
|
end
|
|
|
|
|
2019-01-08 08:30:39 +01:00
|
|
|
context 'when neither procedure or dossier are assigned' do
|
|
|
|
it 'renders a placeholder for the procedure' do
|
|
|
|
expect(subject).to have_selector('.no-procedure')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders the inner content' do
|
|
|
|
expect(subject).to have_text('Column content')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders a generic footer' do
|
|
|
|
expect(subject).to have_text('Mentions légales')
|
|
|
|
end
|
2019-01-07 12:17:11 +01:00
|
|
|
end
|
|
|
|
end
|