Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Oct 10, 2018
1 parent 23049d0 commit 93658d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/miq_ae_engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }
Expand Down

0 comments on commit 93658d0

Please sign in to comment.