2019-03-25 10:53:45 +01:00
|
|
|
|
describe 'users/dossiers/show/header.html.haml', type: :view do
|
2018-08-14 15:02:39 +02:00
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) }
|
|
|
|
|
|
2018-09-20 14:05:18 +02:00
|
|
|
|
before do
|
|
|
|
|
sign_in dossier.user
|
|
|
|
|
end
|
|
|
|
|
|
2019-03-25 10:53:45 +01:00
|
|
|
|
subject! { render 'users/dossiers/show/header.html.haml', dossier: dossier }
|
2018-08-14 15:02:39 +02:00
|
|
|
|
|
|
|
|
|
it 'affiche les informations du dossier' do
|
|
|
|
|
expect(rendered).to have_text(dossier.procedure.libelle)
|
2018-10-08 18:44:19 +02:00
|
|
|
|
expect(rendered).to have_text("Dossier nº #{dossier.id}")
|
2018-08-14 15:02:39 +02:00
|
|
|
|
expect(rendered).to have_text("en construction")
|
|
|
|
|
|
2021-12-24 18:10:50 +01:00
|
|
|
|
expect(rendered).to have_selector("nav.tabs")
|
2018-08-14 15:02:39 +02:00
|
|
|
|
expect(rendered).to have_link("Résumé", href: dossier_path(dossier))
|
2018-08-29 16:57:01 +02:00
|
|
|
|
expect(rendered).to have_link("Demande", href: demande_dossier_path(dossier))
|
2018-08-14 15:02:39 +02:00
|
|
|
|
end
|
2022-03-23 08:03:08 +01:00
|
|
|
|
|
|
|
|
|
context "when the procedure is closed with a dossier en construction" do
|
|
|
|
|
let(:procedure) { create(:procedure, :closed) }
|
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it "n'affiche pas de banner" do
|
|
|
|
|
expect(rendered).not_to have_text("La démarche liée à votre dossier est close")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'can download the dossier' do
|
|
|
|
|
expect(rendered).to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when the procedure is discarded with a dossier en construction" do
|
|
|
|
|
let(:procedure) { create(:procedure, :discarded) }
|
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it 'affiche que la démarche est supprimée' do
|
|
|
|
|
expect(rendered).to have_text("La démarche liée à votre dossier est supprimée")
|
|
|
|
|
expect(rendered).to have_text("Vous pouvez toujours consulter votre dossier, mais il n’est plus possible de le modifier")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'can download the dossier' do
|
|
|
|
|
expect(rendered).to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when the procedure is discarded with a dossier terminé" do
|
|
|
|
|
let(:procedure) { create(:procedure, :discarded) }
|
|
|
|
|
let(:dossier) { create(:dossier, state: "accepte", procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it 'affiche que la démarche est supprimée' do
|
|
|
|
|
expect(rendered).to have_text("La démarche liée à votre dossier est supprimée")
|
|
|
|
|
expect(rendered).to have_text("Votre dossier a été traité par l'administration, aucune action n'est possible")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'can download the dossier' do
|
|
|
|
|
expect(rendered).to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
2018-08-14 15:02:39 +02:00
|
|
|
|
end
|