This commit is contained in:
Xavier J 2016-07-22 12:25:23 +02:00
parent 2ad816b6b3
commit 4e6d153893
3 changed files with 5 additions and 12 deletions

View file

@ -123,12 +123,12 @@ class Admin::ProceduresController < AdminController
def transfer def transfer
admin = Administrateur.find_by_email(params[:email_admin]) admin = Administrateur.find_by_email(params[:email_admin])
#
return render '/admin/procedures/transfer', formats: 'js', status: 404 if admin.nil?
#
procedure = current_administrateur.procedures.find(params[:procedure_id])
return render '/admin/procedures/transfer', formats: 'js', status: 404 if admin.nil?
procedure = current_administrateur.procedures.find(params[:procedure_id])
clone_procedure = procedure.clone clone_procedure = procedure.clone
clone_procedure.administrateur = admin clone_procedure.administrateur = admin
clone_procedure.save clone_procedure.save

View file

@ -8,7 +8,7 @@
=render partial: '/admin/procedures/modal_publish' =render partial: '/admin/procedures/modal_publish'
%a#reenable.btn.btn-small.btn-default{"data-target" => "#transferModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'} %a#transfer.btn.btn-small.btn-default{"data-target" => "#transferModal", "data-toggle" => "modal", :type => "button", style:'float: right; margin-top: 10px'}
%i.fa.fa-exchange %i.fa.fa-exchange
Transférer Transférer

View file

@ -467,12 +467,6 @@ describe Admin::ProceduresController, type: :controller do
let(:email_admin) { new_admin.email } let(:email_admin) { new_admin.email }
it { expect(subject.status).to eq 200 } it { expect(subject.status).to eq 200 }
it 'procedure clone is called' do
expect_any_instance_of(Procedure).to receive(:clone)
subject
end
it { expect {subject}.to change(Procedure, :count).by(1) } it { expect {subject}.to change(Procedure, :count).by(1) }
context { context {
@ -482,7 +476,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(Procedure.last.administrateur).to eq new_admin } it { expect(Procedure.last.administrateur).to eq new_admin }
} }
end end
end end
end end