2018-08-14 15:06:44 +02:00
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
2018-08-29 16:57:01 +02:00
|
|
|
|
describe 'new_user/dossiers/demande.html.haml', type: :view do
|
2018-08-14 15:06:44 +02:00
|
|
|
|
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
|
2018-09-20 14:05:18 +02:00
|
|
|
|
sign_in dossier.user
|
2018-08-14 15:06:44 +02:00
|
|
|
|
assign(:dossier, dossier)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
subject! { render }
|
|
|
|
|
|
|
|
|
|
it 'renders the header' do
|
2018-10-08 18:44:19 +02:00
|
|
|
|
expect(rendered).to have_text("Dossier nº #{dossier.id}")
|
2018-08-14 15:06:44 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'renders the dossier infos' do
|
2019-02-19 11:41:20 +01:00
|
|
|
|
expect(rendered).to have_text('Déposé le')
|
2018-08-14 15:06:44 +02:00
|
|
|
|
expect(rendered).to have_text('Identité')
|
2018-08-29 16:57:01 +02:00
|
|
|
|
expect(rendered).to have_text('Demande')
|
2018-08-14 15:06:44 +02:00
|
|
|
|
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
|
2019-02-19 11:41:20 +01:00
|
|
|
|
|
|
|
|
|
context 'when the dossier has no en_construction_at date' do
|
|
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it { expect(rendered).not_to have_text('Déposé le') }
|
|
|
|
|
end
|
2018-08-14 15:06:44 +02:00
|
|
|
|
end
|