demarches-normaliennes/spec/views/users/dossiers/brouillon.html.haml_spec.rb

36 lines
1 KiB
Ruby
Raw Normal View History

require 'spec_helper'
2019-03-25 10:53:45 +01:00
describe 'users/dossiers/brouillon.html.haml', type: :view do
let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service) }
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
let(:footer) { view.content_for(:footer) }
before do
sign_in dossier.user
assign(:dossier, dossier)
end
subject! { render }
2018-09-05 14:48:42 +02:00
it 'affiche le libellé de la démarche' do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'affiche un lien vers la notice' do
2019-12-19 18:29:01 +01:00
expect(response).to have_css("a[href*='/rails/active_storage/blobs/']", text: "Guide de la démarche")
end
it 'affiche les boutons de validation' do
2019-09-17 16:09:19 +02:00
expect(rendered).to have_selector('.send-dossier-actions-bar')
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
end
2018-09-05 14:48:42 +02:00
context 'quand la démarche ne comporte pas de notice' do
let(:procedure) { create(:procedure) }
it { is_expected.not_to have_link("Guide de la démarche") }
end
end