From a002ec1894b52ee32ca16d11ff955530e70ba19c Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 27 Jul 2020 15:55:35 +0100 Subject: [PATCH] Simplify login_as_admin by using existing factory admin_user --- spec/support/request/authentication_helper.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/spec/support/request/authentication_helper.rb b/spec/support/request/authentication_helper.rb index cde0e51912..f439314e5d 100644 --- a/spec/support/request/authentication_helper.rb +++ b/spec/support/request/authentication_helper.rb @@ -2,15 +2,7 @@ module AuthenticationHelper include Warden::Test::Helpers def login_as_admin - admin_role = Spree::Role.find_or_create_by!(name: 'admin') - admin_user = create(:user, - password: 'passw0rd', - password_confirmation: 'passw0rd', - remember_me: false, - persistence_token: 'pass', - login: 'admin@ofn.org') - - admin_user.spree_roles << admin_role + admin_user = create(:admin_user) login_as admin_user admin_user end