Login to consumer section in a way that ensures user is not an admin

This commit is contained in:
Rob Harrington
2015-03-14 11:02:45 +11:00
parent cb28843af1
commit 8b241f058b

View File

@@ -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',