From 4e6d153893c6bd2c6c1ebc42c2bf78e55df2ec1b Mon Sep 17 00:00:00 2001 From: Xavier J Date: Fri, 22 Jul 2016 12:25:23 +0200 Subject: [PATCH] Fix test --- app/controllers/admin/procedures_controller.rb | 8 ++++---- app/views/admin/procedures/show.html.haml | 2 +- spec/controllers/admin/procedures_controller_spec.rb | 7 ------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 37280a65c..1f6539c6d 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -123,12 +123,12 @@ class Admin::ProceduresController < AdminController def transfer 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.administrateur = admin clone_procedure.save diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index f49ffb2bf..494969bcf 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -8,7 +8,7 @@ =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 Transférer diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index a181e3ad1..c6ddc9462 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -467,12 +467,6 @@ describe Admin::ProceduresController, type: :controller do let(:email_admin) { new_admin.email } 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) } context { @@ -482,7 +476,6 @@ describe Admin::ProceduresController, type: :controller do it { expect(Procedure.last.administrateur).to eq new_admin } } - end end end