specs: improve dossier details tests

This commit is contained in:
Pierre de La Morinerie 2018-08-14 15:02:39 +02:00
parent 4714fc64e7
commit c286e5fa41
2 changed files with 18 additions and 3 deletions

View file

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'new_user/dossiers/show.html.haml', type: :view do describe 'new_user/dossiers/show.html.haml', type: :view do
let(:dossier) { create(:dossier, :with_service, state: 'brouillon', procedure: create(:procedure)) } let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) }
before do before do
sign_in dossier.user sign_in dossier.user
@ -10,8 +10,8 @@ describe 'new_user/dossiers/show.html.haml', type: :view do
subject! { render } subject! { render }
it 'affiche les informations du dossier' do it 'renders a summary of the dossier state' do
expect(rendered).to have_text(dossier.procedure.libelle)
expect(rendered).to have_text("Dossier nº #{dossier.id}") expect(rendered).to have_text("Dossier nº #{dossier.id}")
expect(rendered).to have_selector('.status-progress')
end end
end end

View file

@ -0,0 +1,15 @@
describe 'new_user/dossiers/show/header.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) }
subject! { render 'new_user/dossiers/show/header.html.haml', dossier: dossier }
it 'affiche les informations du dossier' do
expect(rendered).to have_text(dossier.procedure.libelle)
expect(rendered).to have_text("Dossier nº #{dossier.id}")
expect(rendered).to have_text("en construction")
expect(rendered).to have_selector("ul.tabs")
expect(rendered).to have_link("Résumé", href: dossier_path(dossier))
expect(rendered).to have_link("Formulaire", href: formulaire_dossier_path(dossier))
end
end