2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2023-03-06 15:51:08 +01:00
|
|
|
|
describe 'dossiers/show/header', type: :view do
|
2022-03-23 08:03:08 +01:00
|
|
|
|
let(:procedure) { create(:procedure, :discarded) }
|
|
|
|
|
let(:dossier) { create(:dossier, state: "brouillon", procedure: procedure) }
|
2022-04-14 11:08:17 +02:00
|
|
|
|
let(:user) { dossier.user }
|
2022-03-23 08:03:08 +01:00
|
|
|
|
|
|
|
|
|
before do
|
2022-04-14 11:08:17 +02:00
|
|
|
|
sign_in user
|
2022-03-23 08:03:08 +01:00
|
|
|
|
end
|
|
|
|
|
|
2023-03-06 15:51:08 +01:00
|
|
|
|
subject! { render 'shared/dossiers/header', dossier: dossier }
|
2022-03-23 08:03:08 +01:00
|
|
|
|
|
|
|
|
|
context "when the procedure is discarded with a dossier en brouillon" do
|
|
|
|
|
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 ne sera pas traité par l'administration")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'cannot download the dossier' do
|
|
|
|
|
expect(rendered).not_to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when the procedure is closed with a dossier en brouillon" do
|
|
|
|
|
let(:procedure) { create(:procedure, :closed) }
|
|
|
|
|
|
|
|
|
|
it 'affiche que la démarche est close' do
|
|
|
|
|
expect(rendered).to have_text("La démarche liée à votre dossier est close")
|
|
|
|
|
expect(rendered).to have_text("Vous pouvez toujours consulter votre dossier, mais il ne sera pas traité par l'administration")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'cannot download the dossier' do
|
|
|
|
|
expect(rendered).not_to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-04-14 11:08:17 +02:00
|
|
|
|
|
|
|
|
|
context "when user is invited" do
|
|
|
|
|
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) }
|
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
create(:invite, user: user, dossier: dossier)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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 not download the dossier' do
|
|
|
|
|
expect(rendered).not_to have_text("Tout le dossier")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-07-13 12:58:42 +02:00
|
|
|
|
|
|
|
|
|
describe "identity edit" do
|
|
|
|
|
context "when the identity is individual" do
|
|
|
|
|
let(:procedure) { create(:procedure, for_individual: true) }
|
|
|
|
|
let(:dossier) { create(:dossier, :with_individual, state: "brouillon", procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it "display identity with an edit link" do
|
|
|
|
|
expect(rendered).to have_text(/Nom\s+#{dossier.individual.nom}/)
|
|
|
|
|
expect(rendered).to have_link("Modifier l’identité")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when the identity is an enterprise" do
|
|
|
|
|
let(:procedure) { create(:procedure, for_individual: false) }
|
|
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, state: "brouillon", procedure: procedure) }
|
|
|
|
|
|
|
|
|
|
it "display short identity with an edit siret link" do
|
|
|
|
|
expect(rendered).to have_text(/Dénomination :\s+#{dossier.etablissement.entreprise_raison_sociale}/)
|
|
|
|
|
expect(rendered).not_to have_text("Numéro de TVA")
|
|
|
|
|
expect(rendered).to have_link("Modifier le SIRET")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-03-23 08:03:08 +01:00
|
|
|
|
end
|