fix(dossier_correction): don't allow to save with a missing (invalid) commentaire

This commit is contained in:
Colin Darie 2023-06-02 12:43:08 +02:00
parent b495e0aff0
commit 52c8553576
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
5 changed files with 24 additions and 7 deletions

View file

@ -547,6 +547,16 @@ describe Instructeurs::DossiersController, type: :controller do
end
end
context 'with an invalid comment / attachment' do
let(:justificatif) { Rack::Test::UploadedFile.new(Rails.root.join('Gemfile.lock'), 'text/lock') }
it 'does not save anything' do
expect(dossier.reload).not_to be_pending_correction
expect(dossier.commentaires.count).to eq(0)
expect(response.body).to include('pas dun type accepté')
end
end
context 'with an empty message' do
let(:message) { '' }