From 2983a0e3310d5360ad6d4fcd6ee56a8e4c7355f3 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Sun, 5 Mar 2017 18:40:43 +0200 Subject: [PATCH] Allow api_user_with_unlimited_balance factory to accept registrar --- spec/factories/api_user.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/factories/api_user.rb b/spec/factories/api_user.rb index 01c2c70e0..a38fb8bf9 100644 --- a/spec/factories/api_user.rb +++ b/spec/factories/api_user.rb @@ -10,8 +10,13 @@ FactoryGirl.define do end factory :api_user_with_unlimited_balance do - after :build do |api_user| - api_user.registrar = create(:registrar_with_unlimited_balance) + transient do + registrar false + end + + after :build do |api_user, evaluator| + registrar = (evaluator.registrar || create(:registrar_with_unlimited_balance)) + api_user.registrar = registrar end end end