diff --git a/spec/factories/miq_request.rb b/spec/factories/miq_request.rb index 5971cacf8d1..2ca53cb266b 100644 --- a/spec/factories/miq_request.rb +++ b/spec/factories/miq_request.rb @@ -12,5 +12,15 @@ factory :miq_provision_request, :class => "MiqProvisionRequest" do source { create(:miq_template) } end + + trait :with_approval do + transient do + reason "" + end + + after(:create) do |request, evaluator| + request.miq_approvals << FactoryGirl.create(:miq_approval, :reason => evaluator.reason) + end + end end end