specs: refactor a view spec to be clearer and faster

This commit is contained in:
Pierre de La Morinerie 2019-01-09 11:50:19 +01:00
parent 5719107cbc
commit 6a0996c5f3

View file

@ -22,20 +22,24 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
before { dossier.avis << avis }
it { is_expected.to include(champ1.libelle) }
it { is_expected.to include(champ1.value) }
it "renders titles and values of champs" do
expect(subject).to include(champ1.libelle)
expect(subject).to include(champ1.value)
it { is_expected.to have_css(".header-section") }
it { is_expected.to include(champ2.libelle) }
expect(subject).to have_css(".header-section")
expect(subject).to include(champ2.libelle)
it { is_expected.not_to include(champ3.libelle) }
it { is_expected.not_to include(champ3.value) }
expect(subject).to have_link("Dossier nº #{dossier.id}")
expect(subject).to include(dossier.text_summary)
it { is_expected.to have_link("Dossier nº #{dossier.id}") }
it { is_expected.to include(dossier.text_summary) }
expect(subject).to include(champ5.libelle)
expect(subject).to include(champ5.libelle)
end
it { is_expected.to include(champ5.libelle) }
it { is_expected.to include(champ5.libelle) }
it "doesn't render explication champs" do
expect(subject).not_to include(champ3.libelle)
expect(subject).not_to include(champ3.value)
end
end
context "with a dossier champ, but we are not authorized to acces the dossier" do