Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for set_automation_attributes on things longer than one word #248

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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