From fa1a373b5b65131e64ac8acaa214a900f8cdf839 Mon Sep 17 00:00:00 2001 From: Aparna Karve Date: Mon, 4 Dec 2017 09:52:55 -0800 Subject: [PATCH 1/2] Spec that shows the error for `select_check?` --- spec/controllers/vm_infra_controller_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/controllers/vm_infra_controller_spec.rb b/spec/controllers/vm_infra_controller_spec.rb index a7a67394af3..f54a5ed14f8 100644 --- a/spec/controllers/vm_infra_controller_spec.rb +++ b/spec/controllers/vm_infra_controller_spec.rb @@ -539,4 +539,15 @@ include_examples '#download_summary_pdf', :template_vmware it_behaves_like "explorer controller with custom buttons" + + it "executes select_check? and disable_check? helper methods" do + admin_user = FactoryGirl.create(:user_with_group, :role => 'super_administrator') + wf = FactoryGirl.create(:miq_provision_workflow, :requester => admin_user) + + controller.send(:select_check?, wf) + expect(response.status).to eq(200) + + controller.send(:disable_check?, wf) + expect(response.status).to eq(200) + end end From e89717d025523f0606d693ae9a0405a66fb92d97 Mon Sep 17 00:00:00 2001 From: Aparna Karve Date: Mon, 4 Dec 2017 09:53:59 -0800 Subject: [PATCH 2/2] Include the helper ProvisionCustomizeHelper to access it's methods --- app/controllers/vm_common.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/vm_common.rb b/app/controllers/vm_common.rb index 672440940ea..1c5c6d9f61d 100644 --- a/app/controllers/vm_common.rb +++ b/app/controllers/vm_common.rb @@ -2,6 +2,7 @@ module VmCommon extend ActiveSupport::Concern include ActionView::Helpers::JavaScriptHelper include ChargebackPreview + include ProvisionCustomizeHelper def textual_group_list [ @@ -14,6 +15,8 @@ def textual_group_list private :textual_group_list helper_method :textual_group_list helper_method :parent_choices_with_no_parent_choice + helper_method :select_check? + helper_method :disable_check? end # handle buttons pressed on the button bar