From 971c8f3e1c7b3f0c30c0f5ecb48a6d7693883619 Mon Sep 17 00:00:00 2001 From: Hilda Stastna Date: Tue, 27 Feb 2018 16:52:01 +0100 Subject: [PATCH 1/2] Fix Default Views settings for Service Catalogs Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1404207 Fix Default Views settings for Services > Catalogs > Service Catalogs accordion. --- app/controllers/catalog_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 00b9395222d..50250e9b7a2 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -964,6 +964,7 @@ def service_template_list(scope, options = {}) :function => "miqOrderService", :title => _("Order this Service")} # Show a button instead of the checkbox end + options[:gtl_dbname] = :catalog end options[:named_scope] = scope process_show_list(options) From e54d3b951a226326344f327c3f679d59f2c22853 Mon Sep 17 00:00:00 2001 From: Hilda Stastna Date: Thu, 1 Mar 2018 14:35:40 +0100 Subject: [PATCH 2/2] Add spec test to check options for Service Catalogs page view Add spec test to check options for Service Catalogs page view in service_template_list method, for proper setting of @gtl_type variable in application controller. --- spec/controllers/catalog_controller_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/controllers/catalog_controller_spec.rb b/spec/controllers/catalog_controller_spec.rb index 8dd56a7be8c..3270e2afca6 100644 --- a/spec/controllers/catalog_controller_spec.rb +++ b/spec/controllers/catalog_controller_spec.rb @@ -1079,4 +1079,21 @@ end end end + + describe '#service_template_list' do + let(:sandbox) { {:active_tree => tree} } + + before do + controller.instance_variable_set(:@sb, sandbox) + end + + context 'Service Catalogs accordion' do + let(:tree) { :svccat_tree } + + it 'sets options for rendering proper type of view' do + expect(controller).to receive(:process_show_list).with(:gtl_dbname => :catalog, :named_scope => {}) + controller.send(:service_template_list, {}) + end + end + end end