2018-06-19 16:23:43 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-03-25 10:53:45 +01:00
|
|
|
describe 'users/dossiers/brouillon.html.haml', type: :view do
|
2019-07-25 15:57:00 +02:00
|
|
|
let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service, for_individual: true) }
|
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
2018-06-19 16:23:43 +02:00
|
|
|
let(:footer) { view.content_for(:footer) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in dossier.user
|
|
|
|
assign(:dossier, dossier)
|
|
|
|
end
|
|
|
|
|
2018-07-09 15:55:58 +02:00
|
|
|
subject! { render }
|
2018-06-19 16:23:43 +02:00
|
|
|
|
2018-09-05 14:48:42 +02:00
|
|
|
it 'affiche le libellé de la démarche' do
|
2018-07-09 15:55:58 +02:00
|
|
|
expect(rendered).to have_text(dossier.procedure.libelle)
|
|
|
|
end
|
2018-06-19 16:23:43 +02:00
|
|
|
|
2018-07-11 17:11:44 +02:00
|
|
|
it 'affiche un lien vers la notice' do
|
|
|
|
expect(rendered).to have_link("Guide de la démarche", href: url_for(procedure.notice))
|
|
|
|
end
|
|
|
|
|
2018-07-09 15:55:58 +02:00
|
|
|
it 'affiche les boutons de validation' do
|
2019-09-17 16:09:19 +02:00
|
|
|
expect(rendered).to have_selector('.send-dossier-actions-bar')
|
2018-07-09 15:55:58 +02:00
|
|
|
end
|
2018-06-19 16:23:43 +02:00
|
|
|
|
2018-07-09 15:55:58 +02:00
|
|
|
it 'prépare le footer' do
|
|
|
|
expect(footer).to have_selector('footer')
|
2018-06-19 16:23:43 +02:00
|
|
|
end
|
2018-07-11 17:11:44 +02:00
|
|
|
|
2018-09-05 14:48:42 +02:00
|
|
|
context 'quand la démarche ne comporte pas de notice' do
|
2018-07-11 17:11:44 +02:00
|
|
|
let(:procedure) { create(:procedure) }
|
|
|
|
it { is_expected.not_to have_link("Guide de la démarche") }
|
|
|
|
end
|
2018-06-19 16:23:43 +02:00
|
|
|
end
|