Skip to content

Commit

Permalink
Fixed to pass in parameter to method call
Browse files Browse the repository at this point in the history
  • Loading branch information
h-kataria committed Oct 16, 2017
1 parent fd0d087 commit 6a1d192
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/mixins/actions/host_actions/misc.rb
Expand Up @@ -30,7 +30,7 @@ def process_hosts_refresh(hosts, task, display_name)
:product => I18n.t('product.name'),
:count => hosts.length})
AuditEvent.success(:userid => session[:userid], :event => "host_#{task}",
:message => "'#{task_name}' successfully initiated for #{pluralize(hosts.length, "Host")}",
:message => "'#{task_name(task)}' successfully initiated for #{pluralize(hosts.length, "Host")}",
:target_class => "Host")
end

Expand Down
19 changes: 15 additions & 4 deletions spec/controllers/application_controller/ci_processing_spec.rb
Expand Up @@ -806,16 +806,27 @@
end

context "#process_hosts" do
it "initiates host destroy" do
host = FactoryGirl.create(:host)
allow(controller).to receive(:filter_ids_in_region).and_return([[host], nil])
before do
@host1 = FactoryGirl.create(:host)
@host2 = FactoryGirl.create(:host)
allow(controller).to receive(:filter_ids_in_region).and_return([[@host1, @host2], nil])
allow(MiqServer).to receive(:my_zone).and_return("default")
controller.send(:process_hosts, [host], 'destroy')
end

it "initiates host destroy" do
controller.send(:process_hosts, [@host1], 'destroy')
audit_event = AuditEvent.all.first
task = MiqQueue.find_by_class_name("Host")
expect(audit_event['message']).to include "Record delete initiated"
expect(task.method_name).to eq 'destroy'
end

it "initiates refresh for selected hosts" do
controller.send(:process_hosts, [@host1, @host2], 'refresh_ems')
audit_event = AuditEvent.all.first
MiqQueue.find_by_class_name("Host")
expect(audit_event['message']).to include "'Refresh Provider' successfully initiated for 2 Hosts"
end
end

context "#vm_button_operation" do
Expand Down

0 comments on commit 6a1d192

Please sign in to comment.