2018-09-25 15:56:18 +02:00
|
|
|
describe 'shared/dossiers/demande.html.haml', type: :view do
|
2019-08-06 11:02:54 +02:00
|
|
|
let(:current_instructeur) { create(:instructeur) }
|
2018-09-25 15:56:18 +02:00
|
|
|
let(:individual) { nil }
|
|
|
|
let(:etablissement) { nil }
|
|
|
|
let(:procedure) { create(:procedure, :published) }
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, procedure: procedure, etablissement: etablissement, individual: individual) }
|
|
|
|
|
|
|
|
before do
|
2019-08-07 11:15:16 +02:00
|
|
|
sign_in(current_instructeur.user)
|
2018-09-25 15:56:18 +02:00
|
|
|
end
|
|
|
|
|
2018-10-17 12:12:32 +02:00
|
|
|
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
|
2018-09-25 15:56:18 +02:00
|
|
|
|
|
|
|
context 'when dossier was created by an etablissement' do
|
|
|
|
let(:etablissement) { create(:etablissement) }
|
|
|
|
|
|
|
|
it 'renders the etablissement infos' do
|
|
|
|
expect(rendered).to include(etablissement.entreprise_raison_sociale)
|
|
|
|
expect(rendered).to include(etablissement.entreprise_siret_siege_social)
|
|
|
|
expect(rendered).to include(etablissement.entreprise_forme_juridique)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'and entreprise is an association' do
|
|
|
|
let(:etablissement) { create(:etablissement, :is_association) }
|
|
|
|
|
|
|
|
it 'renders the association infos' do
|
|
|
|
expect(rendered).to include(etablissement.association_rna)
|
|
|
|
expect(rendered).to include(etablissement.association_titre)
|
|
|
|
expect(rendered).to include(etablissement.association_objet)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when dossier was created by an individual' do
|
|
|
|
let(:individual) { create(:individual) }
|
|
|
|
|
|
|
|
it 'renders the individual identity infos' do
|
|
|
|
expect(rendered).to include(individual.gender)
|
|
|
|
expect(rendered).to include(individual.nom)
|
|
|
|
expect(rendered).to include(individual.prenom)
|
2019-06-05 17:07:38 +02:00
|
|
|
expect(rendered).to include(I18n.l(individual.birthdate))
|
2018-09-25 15:56:18 +02:00
|
|
|
end
|
|
|
|
end
|
2018-09-25 15:56:49 +02:00
|
|
|
|
|
|
|
context 'when the dossier has champs' do
|
|
|
|
let(:procedure) { create(:procedure, :published, :with_type_de_champ) }
|
|
|
|
|
|
|
|
it 'renders the champs' do
|
|
|
|
dossier.champs.each do |champ|
|
|
|
|
expect(rendered).to include(champ.libelle)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-09-25 15:56:18 +02:00
|
|
|
end
|