From 8b241f058b5979f5823a567ede45fbc6809a996a Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Sat, 14 Mar 2015 11:02:45 +1100 Subject: [PATCH] Login to consumer section in a way that ensures user is not an admin --- spec/support/request/authentication_workflow.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/support/request/authentication_workflow.rb b/spec/support/request/authentication_workflow.rb index 5e0c2cfb3d..0995367600 100644 --- a/spec/support/request/authentication_workflow.rb +++ b/spec/support/request/authentication_workflow.rb @@ -38,6 +38,7 @@ module AuthenticationWorkflow visit spree.admin_path end + # TODO: Should probably just rename this to create_user def create_enterprise_user( attrs = {} ) new_user = create(:user, attrs) new_user.spree_roles = [] # for some reason unbeknown to me, this new user gets admin permissions by default. @@ -55,11 +56,8 @@ module AuthenticationWorkflow end def login_to_consumer_section - # The first user is given the admin role by Spree, so create a dummy user if this is the first - create(:user) if Spree::User.admin.empty? - user_role = Spree::Role.find_or_create_by_name!('user') - user = Spree::User.create!({ + user = create_enterprise_user({ :email => 'someone@ofn.org', :password => 'passw0rd', :password_confirmation => 'passw0rd',