diff --git a/app/models/conversion_host/configurations.rb b/app/models/conversion_host/configurations.rb index a8b2b6246b4..b3fc8a0b118 100644 --- a/app/models/conversion_host/configurations.rb +++ b/app/models/conversion_host/configurations.rb @@ -100,7 +100,7 @@ def disable_queue(auth_user = nil) self.class.queue_configuration('disable', id, resource, {}, auth_user) end - def disable + def disable(_params = nil, _auth_user = nil) resource_info = "type=#{resource.class.name} id=#{resource.id}" _log.debug("Disabling a conversion_host #{resource_info}") diff --git a/spec/models/conversion_host/configurations_spec.rb b/spec/models/conversion_host/configurations_spec.rb index 1744d967e4a..69e09398941 100644 --- a/spec/models/conversion_host/configurations_spec.rb +++ b/spec/models/conversion_host/configurations_spec.rb @@ -143,6 +143,16 @@ context "#disable_queue" do let(:op) { 'disable' } + let(:expected_notify) do + { + :type => :conversion_host_config_success, + :options => { + :op_name => "disable", + :op_arg => "type=#{vm.class.name} id=#{vm.id}" + } + } + end + it "to queue with a task" do task_id = conversion_host.disable_queue expect(MiqTask.find(task_id)).to have_attributes(:name => expected_task_action) @@ -156,6 +166,15 @@ :zone => conversion_host.resource.ext_management_system.my_zone ) end + + it "calls the disable method if delivered" do + allow(conversion_host).to receive(:disable_conversion_host_role) + allow(ConversionHost).to receive(:find).with(conversion_host.id).and_return(conversion_host) + + expect(Notification).to receive(:create).with(expected_notify) + conversion_host.disable_queue + expect(MiqQueue.first.deliver).to include("ok") + end end end end