From c78adba6d35d1ea1f04bf425eecafaf88a0e3b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 14 Feb 2019 18:56:34 +0100 Subject: [PATCH] Refactor spec/factories/users.rb to allow EE to extend it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/factories/users.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/factories/users.rb b/spec/factories/users.rb index a47bd7cafca..1d2b724a5e5 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -73,11 +73,16 @@ FactoryBot.define do end after(:create) do |user, evaluator| - user.identities << create( - :identity, + identity_attrs = { provider: evaluator.provider, extern_uid: evaluator.extern_uid - ) + } + + if evaluator.respond_to?(:saml_provider) + identity_attrs[:saml_provider] = evaluator.saml_provider + end + + user.identities << create(:identity, identity_attrs) end end