From 93658d0fcbe2255987ab8458afb3f927ecbafa4e Mon Sep 17 00:00:00 2001 From: d-m-u Date: Wed, 10 Oct 2018 16:18:35 -0400 Subject: [PATCH] Test https://github.com/ManageIQ/manageiq/pull/18084 --- spec/miq_ae_engine_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/miq_ae_engine_spec.rb b/spec/miq_ae_engine_spec.rb index 9be4c6ef5..cf279521a 100644 --- a/spec/miq_ae_engine_spec.rb +++ b/spec/miq_ae_engine_spec.rb @@ -453,6 +453,7 @@ def call_automate(obj_type, obj_id, open_url_task_id = nil) end context ".set_automation_attributes_from_objects" do + let(:orch_stack) { FactoryGirl.create(:orchestration_stack) } before(:each) do FactoryGirl.create(:small_environment) end @@ -469,6 +470,13 @@ def call_automate(obj_type, obj_id, open_url_task_id = nil) expect(hash).to eq(expected_hash) end + it "with an array of nil and valid objects that are longer than single words" do + hash = {:a => 'A', 'b' => 'b'} + expected_hash = hash.merge("VmOrTemplate::vm" => Vm.first.id, "Host::host" => Host.first.id, "OrchestrationStack::orchestration_stack" => orch_stack.id) + MiqAeEngine.set_automation_attributes_from_objects([Vm.first, nil, Host.first, OrchestrationStack.first], hash) + expect(hash).to eq(expected_hash) + end + it "raise error if the object is already in the hash" do hash = {:a => 'A', "VmOrTemplate::vm" => Vm.first.id} expect { MiqAeEngine.set_automation_attributes_from_objects([Vm.first], hash) }