Follow: add flash notice to dossier_controller
This commit is contained in:
parent
95fbd1824a
commit
b80d6a6a59
2 changed files with 5 additions and 0 deletions
|
@ -11,11 +11,14 @@ module NewGestionnaire
|
||||||
def follow
|
def follow
|
||||||
current_gestionnaire.follow(dossier)
|
current_gestionnaire.follow(dossier)
|
||||||
dossier.next_step!('gestionnaire', 'follow')
|
dossier.next_step!('gestionnaire', 'follow')
|
||||||
|
flash.notice = 'Dossier suivi'
|
||||||
redirect_back(fallback_location: procedures_url)
|
redirect_back(fallback_location: procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unfollow
|
def unfollow
|
||||||
current_gestionnaire.followed_dossiers.delete(dossier)
|
current_gestionnaire.followed_dossiers.delete(dossier)
|
||||||
|
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
|
||||||
|
|
||||||
redirect_back(fallback_location: procedures_url)
|
redirect_back(fallback_location: procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
|
it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
|
||||||
|
it { expect(flash.notice).to eq('Dossier suivi') }
|
||||||
it { expect(response).to redirect_to(procedures_url) }
|
it { expect(response).to redirect_to(procedures_url) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(gestionnaire.followed_dossiers).to match([]) }
|
it { expect(gestionnaire.followed_dossiers).to match([]) }
|
||||||
|
it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") }
|
||||||
it { expect(response).to redirect_to(procedures_url) }
|
it { expect(response).to redirect_to(procedures_url) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue