Allow the cloning of another admininistrateur’s procedure

This commit is contained in:
gregoirenovel 2018-01-08 14:44:28 +01:00
parent ec5b9c86ce
commit 27a8aba53e
2 changed files with 5 additions and 3 deletions

View file

@ -159,7 +159,7 @@ class Admin::ProceduresController < AdminController
end
def clone
procedure = current_administrateur.procedures.find(params[:procedure_id])
procedure = Procedure.find(params[:procedure_id])
new_procedure = procedure.clone(current_administrateur)
if new_procedure

View file

@ -444,8 +444,10 @@ describe Admin::ProceduresController, type: :controller do
subject
end
it { expect(response).to redirect_to :admin_procedures }
it { expect(flash[:alert]).to have_content 'Procédure inexistante' }
it 'creates a new procedure and redirect to it' do
expect(response).to redirect_to edit_admin_procedure_path(id: Procedure.last.id)
expect(flash[:notice]).to have_content 'Procédure clonée'
end
end
end