2017-07-11 16:50:29 +02:00
|
|
|
describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
|
2017-12-05 16:07:05 +01:00
|
|
|
before { view.extend DossierHelper }
|
|
|
|
|
2017-10-23 10:29:46 +02:00
|
|
|
let(:current_gestionnaire) { create(:gestionnaire) }
|
2017-07-11 16:50:29 +02:00
|
|
|
let(:individual) { nil }
|
2018-04-05 18:54:33 +02:00
|
|
|
let(:etablissement) { nil }
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, etablissement: etablissement, individual: individual) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:dossier, dossier)
|
2018-01-09 14:37:39 +01:00
|
|
|
allow(view).to receive(:current_gestionnaire).and_return(current_gestionnaire)
|
2017-07-11 16:50:29 +02:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
2018-04-05 18:54:33 +02:00
|
|
|
context "when dossier was created by an etablissement" do
|
|
|
|
let(:etablissement) { create(:etablissement) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
2018-04-23 12:01:03 +02:00
|
|
|
it { expect(rendered).to include(etablissement.entreprise_raison_sociale) }
|
2018-04-05 18:54:33 +02:00
|
|
|
it { expect(rendered).to include(etablissement.entreprise_siret_siege_social) }
|
|
|
|
it { expect(rendered).to include(etablissement.entreprise_forme_juridique) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
|
|
|
context "and entreprise is an association" do
|
2018-04-05 18:54:33 +02:00
|
|
|
let(:etablissement) { create(:etablissement, :is_association) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
2018-04-05 18:54:33 +02:00
|
|
|
it { expect(rendered).to include(etablissement.association_rna) }
|
|
|
|
it { expect(rendered).to include(etablissement.association_titre) }
|
|
|
|
it { expect(rendered).to include(etablissement.association_objet) }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when dossier was created by an individual" do
|
|
|
|
let(:individual) { create(:individual) }
|
|
|
|
|
|
|
|
it { expect(rendered).to include(individual.gender) }
|
|
|
|
it { expect(rendered).to include(individual.nom) }
|
|
|
|
it { expect(rendered).to include(individual.prenom) }
|
2018-04-03 16:38:54 +02:00
|
|
|
it { expect(rendered).to include(individual.birthdate.strftime("%d/%m/%Y")) }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
|
|
|
end
|