2017-07-11 16:50:29 +02:00
|
|
|
describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do
|
|
|
|
before { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs }
|
|
|
|
|
2017-11-21 17:20:52 +01:00
|
|
|
context "there are some champs" do
|
|
|
|
let(:dossier) { create(:dossier) }
|
2017-07-11 16:50:29 +02:00
|
|
|
let(:champ1) { create(:champ, :checkbox, value: "true") }
|
|
|
|
let(:champ2) { create(:champ, :header_section, value: "Section") }
|
2017-10-03 15:08:39 +02:00
|
|
|
let(:champ3) { create(:champ, :explication, value: "mazette") }
|
2017-11-21 17:20:52 +01:00
|
|
|
let(:champ4) { create(:champ, :dossier_link, value: dossier.id) }
|
|
|
|
let(:champs) { [champ1, champ2, champ3, champ4] }
|
2017-07-11 16:50:29 +02:00
|
|
|
|
|
|
|
it { expect(rendered).to include(champ1.libelle) }
|
|
|
|
it { expect(rendered).to include(champ1.value) }
|
|
|
|
|
|
|
|
it { expect(rendered).to have_css(".header-section") }
|
|
|
|
it { expect(rendered).to include(champ2.libelle) }
|
2017-10-03 15:08:39 +02:00
|
|
|
|
|
|
|
it { expect(rendered).not_to include(champ3.libelle) }
|
|
|
|
it { expect(rendered).not_to include(champ3.value) }
|
2017-11-21 17:20:52 +01:00
|
|
|
|
|
|
|
it { expect(rendered).to have_link("Dossier nº #{dossier.id}") }
|
|
|
|
it { expect(rendered).to include(dossier.text_summary) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a dossier_link champ but without value" do
|
|
|
|
let(:champ) { create(:champ, :dossier_link, value: nil) }
|
|
|
|
let(:champs) { [champ] }
|
|
|
|
|
|
|
|
it { expect(rendered).to include("Pas de dossier associé") }
|
2017-07-11 16:50:29 +02:00
|
|
|
end
|
|
|
|
end
|