Allow the cloning of another admininistrateur’s procedure
This commit is contained in:
parent
ec5b9c86ce
commit
27a8aba53e
2 changed files with 5 additions and 3 deletions
|
@ -159,7 +159,7 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def clone
|
def clone
|
||||||
procedure = current_administrateur.procedures.find(params[:procedure_id])
|
procedure = Procedure.find(params[:procedure_id])
|
||||||
|
|
||||||
new_procedure = procedure.clone(current_administrateur)
|
new_procedure = procedure.clone(current_administrateur)
|
||||||
if new_procedure
|
if new_procedure
|
||||||
|
|
|
@ -444,8 +444,10 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to redirect_to :admin_procedures }
|
it 'creates a new procedure and redirect to it' do
|
||||||
it { expect(flash[:alert]).to have_content 'Procédure inexistante' }
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue