diff --git a/app/models/resource_action.rb b/app/models/resource_action.rb index 5f855b561dc..28ab70c5223 100644 --- a/app/models/resource_action.rb +++ b/app/models/resource_action.rb @@ -30,7 +30,7 @@ def automate_queue_hash(target, override_attrs, user, open_url_task_id = nil) end attrs = (ae_attributes || {}).merge(override_attrs || {}) - attrs["result_format"] = 'ignore' if resource&.options&.dig(:open_url) + attrs["result_format"] = 'ignore' { :namespace => ae_namespace, diff --git a/spec/models/resource_action_spec.rb b/spec/models/resource_action_spec.rb index 266b2494479..986df22fc22 100644 --- a/spec/models/resource_action_spec.rb +++ b/spec/models/resource_action_spec.rb @@ -4,7 +4,7 @@ let(:zone_name) { "default" } let(:ra) { FactoryBot.create(:resource_action) } let(:miq_server) { FactoryBot.create(:miq_server) } - let(:ae_attributes) { {} } + let(:ae_attributes) { { "result_format" => "ignore"} } let(:q_args) do { :namespace => nil, @@ -109,18 +109,13 @@ end context "#automate_queue_hash" do - let(:button) { FactoryBot.create(:custom_button, :options => {:open_url => true}, :applies_to_class => "Vm") } + let(:button) { FactoryBot.create(:custom_button, :applies_to_class => "Vm") } let(:ra) { FactoryBot.create(:resource_action, :resource => button) } let(:user) { FactoryBot.create(:user_with_group) } let(:target) { FactoryBot.create(:vm_vmware) } - it "adds result_format for open_url" do + it "adds result_format" do expect(ra.automate_queue_hash(target, {}, user)).to include(:attrs => {"result_format"=>"ignore"}) end - - it "does not add result_format for not open_url" do - button.options[:open_url] = false - expect(ra.automate_queue_hash(target, {}, user)).not_to include(:attrs => {"result_format"=>"ignore"}) - end end end