diff --git a/app/controllers/application_controller/ci_processing.rb b/app/controllers/application_controller/ci_processing.rb index c45a93fb1b9..c490d982eda 100644 --- a/app/controllers/application_controller/ci_processing.rb +++ b/app/controllers/application_controller/ci_processing.rb @@ -75,6 +75,8 @@ def get_class_from_controller_param(controller) Service when "vm_or_template", "vm_infra", "vm_cloud", "vm" VmOrTemplate + when "miq_template" + MiqTemplate end end diff --git a/spec/controllers/application_controller/ci_processing_spec.rb b/spec/controllers/application_controller/ci_processing_spec.rb index bab7d126a79..5fc4bb4ea92 100644 --- a/spec/controllers/application_controller/ci_processing_spec.rb +++ b/spec/controllers/application_controller/ci_processing_spec.rb @@ -865,4 +865,31 @@ include("Retirement initiated for 1 Service from the %{product} Database" % {:product => I18n.t('product.name')}) end end + + describe MiqTemplateController do + context "#vm_button_operation" do + before do + _guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone + allow(MiqServer).to receive(:my_zone).and_return("default") + controller.instance_variable_set(:@lastaction, "show_list") + end + + it "should continue to set ownership for a template" do + controller.request.parameters["controller"] = "miq_template" + allow(controller).to receive(:role_allows?).and_return(true) + allow(controller).to receive(:drop_breadcrumb) + template = FactoryGirl.create(:template, + :ext_management_system => FactoryGirl.create(:ems_openstack_infra), + :storage => FactoryGirl.create(:storage)) + controller.instance_variable_set(:@_params, + :miq_grid_checks => template.id.to_s, + :pressed => 'miq_template_set_ownership') + expect(controller).to receive(:javascript_redirect).with(:controller => "miq_template", + :action => 'ownership', + :rec_ids => [template.id], + :escape => false) + controller.send('set_ownership') + end + end + end end