From c52b959186218c5dac520e5af8a4bd8f32664d52 Mon Sep 17 00:00:00 2001 From: Tomas Coufal Date: Fri, 2 Feb 2018 10:29:41 +0100 Subject: [PATCH] Add MiqRequest factory with MiqApproval --- spec/factories/miq_request.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) 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