dossier: add a notice when some attachments of the dossier were lost

On the 22/01/2020, a technical error on the demarches-simplifees.fr
instance made us delete some files attached to some dossiers.

This PR adds a warning when browsing a dossier containing attachments
that were deleted.
This commit is contained in:
Pierre de La Morinerie 2020-01-27 13:28:23 +00:00
parent 7c60b9dfa8
commit 7ba76c6658
7 changed files with 1061 additions and 12 deletions

View file

@ -9,24 +9,24 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
sign_in(current_instructeur.user)
end
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
subject { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
context 'when dossier was created by an etablissement' do
let(:etablissement) { create(:etablissement) }
it 'renders the etablissement infos' do
expect(rendered).to include(etablissement.entreprise_raison_sociale)
expect(rendered).to include(etablissement.entreprise_siret_siege_social)
expect(rendered).to include(etablissement.entreprise_forme_juridique)
expect(subject).to include(etablissement.entreprise_raison_sociale)
expect(subject).to include(etablissement.entreprise_siret_siege_social)
expect(subject).to include(etablissement.entreprise_forme_juridique)
end
context 'and entreprise is an association' do
let(:etablissement) { create(:etablissement, :is_association) }
it 'renders the association infos' do
expect(rendered).to include(etablissement.association_rna)
expect(rendered).to include(etablissement.association_titre)
expect(rendered).to include(etablissement.association_objet)
expect(subject).to include(etablissement.association_rna)
expect(subject).to include(etablissement.association_titre)
expect(subject).to include(etablissement.association_objet)
end
end
end
@ -35,10 +35,10 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
let(:individual) { create(:individual) }
it 'renders the individual identity infos' do
expect(rendered).to include(individual.gender)
expect(rendered).to include(individual.nom)
expect(rendered).to include(individual.prenom)
expect(rendered).to include(I18n.l(individual.birthdate))
expect(subject).to include(individual.gender)
expect(subject).to include(individual.nom)
expect(subject).to include(individual.prenom)
expect(subject).to include(I18n.l(individual.birthdate))
end
end
@ -47,7 +47,17 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
it 'renders the champs' do
dossier.champs.each do |champ|
expect(rendered).to include(champ.libelle)
expect(subject).to include(champ.libelle)
end
end
context 'when the dossier lost some attachments' do
before do
expect(view).to receive(:has_lost_attachments).and_return(true)
end
it 'displays a warning message' do
expect(subject).to include('Des pièces jointes de votre dossier peuvent être manquantes.')
end
end
end