bug(instructeurs/avis_controller#remind): ETQ instructeur, je peux relancer une demande d'avis meme si celui ci contient une question
This commit is contained in:
parent
02fab28ad6
commit
6a2d2ae0a7
1 changed files with 21 additions and 6 deletions
|
@ -9,12 +9,13 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
let(:instructeur) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||
let!(:avis_without_answer) { create(:avis, dossier: dossier, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
|
||||
before { sign_in(instructeur.user) }
|
||||
|
||||
describe "#revoker" do
|
||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||
|
||||
before do
|
||||
patch :revoquer, params: { procedure_id: procedure.id, id: avis.id }
|
||||
end
|
||||
|
@ -28,12 +29,26 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
before do
|
||||
allow(AvisMailer).to receive(:avis_invitation).and_return(double(deliver_later: nil))
|
||||
end
|
||||
context 'without question' do
|
||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||
|
||||
it 'sends a reminder to the expert' do
|
||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||
expect(avis.reload.reminded_at).to be_present
|
||||
it 'sends a reminder to the expert' do
|
||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||
expect(avis.reload.reminded_at).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
context 'with question' do
|
||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, question_label: '123') }
|
||||
|
||||
it 'sends a reminder to the expert' do
|
||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
||||
expect(AvisMailer).to have_received(:avis_invitation).once.with(avis)
|
||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||
expect(avis.reload.reminded_at).to be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue