demarches-normaliennes/spec/views/new_user/dossiers/demande.html.haml_spec.rb
2018-09-05 11:07:11 +02:00

31 lines
1 KiB
Ruby

require 'spec_helper'
describe 'new_user/dossiers/demande.html.haml', type: :view do
let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) }
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
before do
assign(:dossier, dossier)
end
subject! { render }
it 'renders the header' do
expect(rendered).to have_text("Dossier nº #{dossier.id}")
end
it 'renders the dossier infos' do
expect(rendered).to have_text('Identité')
expect(rendered).to have_text('Demande')
expect(rendered).to have_text('Pièces jointes')
end
context 'when the dossier is editable' do
it { is_expected.to have_link('Modifier le dossier', href: modifier_dossier_path(dossier)) }
end
context 'when the dossier is read-only' do
let(:dossier) { create(:dossier, :en_instruction, :with_entreprise, procedure: procedure) }
it { is_expected.not_to have_link('Modifier le dossier') }
end
end