diff --git a/app/helpers/application_helper/toolbar_builder.rb b/app/helpers/application_helper/toolbar_builder.rb index ac46e00ad6f..a484fb30bd9 100644 --- a/app/helpers/application_helper/toolbar_builder.rb +++ b/app/helpers/application_helper/toolbar_builder.rb @@ -410,7 +410,7 @@ def hide_button_ops(id) def hide_button?(id) # need to hide add buttons when on sub-list view screen of a CI. return true if id.ends_with?("_new", "_discover") && - @lastaction == "show" && !%w(main vms instances).include?(@display) + @lastaction == "show" && !%w(main vms instances all_vms).include?(@display) # user can see the buttons if they can get to Policy RSOP/Automate Simulate screen return false if ["miq_ae_tools"].include?(@layout) diff --git a/spec/helpers/application_helper/toolbar_builder_spec.rb b/spec/helpers/application_helper/toolbar_builder_spec.rb index f9ddc90f4ee..8d13c61ab8f 100644 --- a/spec/helpers/application_helper/toolbar_builder_spec.rb +++ b/spec/helpers/application_helper/toolbar_builder_spec.rb @@ -302,14 +302,16 @@ context 'last action set to show' do let(:lastaction) { 'show' } - context 'requested to display instances' do - let(:display) { 'instances' } - it 'returns with false' do - @lastaction = lastaction - @display = display - @id = 'vm_miq_request_new' - stub_user(:features => :all) - expect(subject).to be_falsey + + %w(main vms instances all_vms).each do |display| + context "requested to display #{display}" do + it 'returns with false' do + stub_user(:features => :all) + @lastaction = lastaction + @display = display + @id = 'vm_miq_request_new' + expect(subject).to be_falsey + end end end end