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) }