2022-03-23 08:03:08 +01:00
|
|
|
describe 'dossiers/show/header.html.haml', type: :view do
|
|
|
|
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
|
|
|
|
|
|
|
|
subject! { render 'shared/dossiers/header.html.haml', dossier: dossier }
|
|
|
|
|
|
|
|
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-03-23 08:03:08 +01:00
|
|
|
end
|