feat(dossier): notify user by email about pending corrections

This commit is contained in:
Colin Darie 2023-03-14 18:48:19 +01:00
parent ca3b127942
commit 9565267170
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
9 changed files with 79 additions and 6 deletions

View file

@ -507,13 +507,23 @@ describe Instructeurs::DossiersController, type: :controller do
}, format: :turbo_stream
end
before { sign_in(instructeur.user) }
before do
sign_in(instructeur.user)
allow(DossierMailer).to receive(:notify_pending_correction)
.and_return(double(deliver_later: nil))
end
context "dossier en instruction" do
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
before { subject }
it 'sends an email to user' do
expect(DossierMailer).to have_received(:notify_pending_correction).once
expect(DossierMailer).to have_received(:notify_pending_correction).with(dossier)
end
it 'pass en_construction and create a pending resolution' do
expect(response).to have_http_status(:ok)
expect(response.body).to include('en attente de modifications')