diff --git a/spec/support/request/authentication_workflow.rb b/spec/support/request/authentication_workflow.rb index e4708a6e97..842a215508 100644 --- a/spec/support/request/authentication_workflow.rb +++ b/spec/support/request/authentication_workflow.rb @@ -29,6 +29,11 @@ module AuthenticationWorkflow new_user = build(:user, attrs) new_user.spree_roles = [Spree::Role.find_or_create_by!(name: 'user')] new_user.save + if attrs.has_key? :enterprises + attrs[:enterprises].each do |enterprise| + enterprise.users << new_user + end + end new_user end