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 }
|
|
|
|
let(:entreprise) { nil }
|
2017-09-21 17:12:21 +02:00
|
|
|
let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:dossier, dossier)
|
2017-10-23 10:29:46 +02:00
|
|
|
view.stub(:current_gestionnaire).and_return(current_gestionnaire)
|
2017-07-11 16:50:29 +02:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when dossier was created by an entreprise" do
|
|
|
|
let(:entreprise) { create(:entreprise) }
|
|
|
|
|
|
|
|
it { expect(rendered).to include(entreprise.decorate.raison_sociale_or_name) }
|
|
|
|
it { expect(rendered).to include(entreprise.decorate.siret_siege_social) }
|
|
|
|
it { expect(rendered).to include(entreprise.decorate.forme_juridique) }
|
|
|
|
|
|
|
|
context "and entreprise is an association" do
|
|
|
|
let(:entreprise) { create(:entreprise, :is_association) }
|
|
|
|
|
|
|
|
it { expect(rendered).to include(entreprise.rna_information.association_id) }
|
|
|
|
it { expect(rendered).to include(entreprise.rna_information.titre) }
|
|
|
|
it { expect(rendered).to include(entreprise.rna_information.objet) }
|
|
|
|
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) }
|
2017-10-17 11:45:00 +02:00
|
|
|
it { expect(rendered).to include(Date.parse(individual.birthdate).strftime("%d/%m/%Y")) }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
|
|
|
end
|