NewDossierController: add next_step follow

This commit is contained in:
Simon Lehericey 2017-07-17 15:14:19 +02:00 committed by Mathieu Magnin
parent 8b2366cb98
commit 6cff044a50
2 changed files with 5 additions and 1 deletions

View file

@ -10,6 +10,7 @@ module NewGestionnaire
def follow
current_gestionnaire.follow(dossier)
dossier.next_step!('gestionnaire', 'follow')
redirect_back(fallback_location: procedures_url)
end

View file

@ -32,7 +32,10 @@ describe NewGestionnaire::DossiersController, type: :controller do
before { sign_in(gestionnaire) }
describe 'follow' do
before { patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
before do
expect_any_instance_of(Dossier).to receive(:next_step!).with('gestionnaire', 'follow')
patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id }
end
it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
it { expect(response).to redirect_to(procedures_url) }