NewDesign: gestionnaire can add a new commentaire

This commit is contained in:
Simon Lehericey 2017-07-19 14:04:49 +02:00 committed by Mathieu Magnin
parent 3ecc4f1327
commit 714b2a5f08
5 changed files with 42 additions and 0 deletions

View file

@ -101,4 +101,23 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
end
end
describe "commentaire" do
let(:saved_commentaire) { dossier.commentaires.first }
before do
sign_in(gestionnaire)
post :create_commentaire, params: {
procedure_id: procedure.id,
dossier_id: dossier.id,
commentaire: { body: 'body' }
}
end
it { expect(saved_commentaire.body).to eq('body') }
it { expect(saved_commentaire.email).to eq(gestionnaire.email) }
it { expect(saved_commentaire.dossier).to eq(dossier) }
it { expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier)) }
end
end