fix(user dossiers index): do not crash with a deleted dossier and a discarded procedure

This commit is contained in:
simon lehericey 2023-06-08 17:28:08 +02:00 committed by LeSim
parent e2d7be215e
commit 44859b8217
3 changed files with 14 additions and 4 deletions

View file

@ -913,6 +913,18 @@ describe Users::DossiersController, type: :controller do
expect(assigns(:dossiers_invites).second.updated_at.to_date).to eq(4.days.ago.to_date)
end
end
context 'when the user has a deleted dossier on a discarded procedure' do
render_views
let!(:deleted_dossier) { create(:deleted_dossier, user_id: user.id) }
before { deleted_dossier.procedure.discard! }
subject { get(:index, params: { statut: 'dossiers-supprimes-definitivement' }) }
it { is_expected.to have_http_status(200) }
end
end
describe '#show' do