File tree Expand file tree Collapse file tree
lib/controllers/backend/spree/admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ RSpec/BeforeAfterAll:
105105
106106# Offense count: 5
107107# This cop supports safe autocorrection (--autocorrect).
108- RSpec/ Capybara/CurrentPathExpectation :
108+ Capybara/CurrentPathExpectation :
109109 Exclude :
110110 - ' spec/features/admin/sign_in_spec.rb'
111111 - ' spec/features/sign_in_spec.rb'
@@ -221,7 +221,6 @@ RSpec/InstanceVariable:
221221 - ' spec/controllers/spree/admin/user_passwords_controller_spec.rb'
222222 - ' spec/controllers/spree/user_passwords_controller_spec.rb'
223223 - ' spec/controllers/spree/user_registrations_controller_spec.rb'
224- - ' spec/controllers/spree/user_sessions_controller_spec.rb'
225224 - ' spec/features/admin/sign_in_spec.rb'
226225 - ' spec/features/checkout_spec.rb'
227226 - ' spec/features/sign_in_spec.rb'
Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ def authorization_failure
3535
3636 private
3737
38+ def signed_in_root_path ( _resource )
39+ spree . admin_path
40+ end
41+
3842 # NOTE: as soon as this gem stops supporting Solidus 3.1 if-else should be removed and left only include
3943 if defined? ( ::Spree ::Admin ::SetsUserLanguageLocaleKey )
4044 include ::Spree ::Admin ::SetsUserLanguageLocaleKey
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ RSpec . describe Spree ::Admin ::UserSessionsController , type : :controller do
4+ let ( :user ) { create ( :user , password : 'secret' ) }
5+
6+ before { @request . env [ 'devise.mapping' ] = Devise . mappings [ :spree_user ] } # rubocop:disable RSpec/InstanceVariable
7+
8+ it "redirects to the admin root after signing in with no stored location" do
9+ get :new
10+
11+ post ( :create , params : {
12+ spree_user : {
13+ email : user . email ,
14+ password : 'secret'
15+ } ,
16+ } )
17+
18+ expect ( response ) . to redirect_to spree . admin_path
19+ end
20+ end
Original file line number Diff line number Diff line change 33RSpec . describe Spree ::UserSessionsController , type : :controller do
44 let ( :user ) { create ( :user ) }
55
6- before { @request . env [ 'devise.mapping' ] = Devise . mappings [ :spree_user ] }
6+ before { @request . env [ 'devise.mapping' ] = Devise . mappings [ :spree_user ] } # rubocop:disable RSpec/InstanceVariable
77
88 context "#create" do
99 let ( :format ) { :html }
1010 let ( :password ) { 'secret' }
1111
1212 subject do
13- post ( :create ,
14- params : {
15- spree_user : {
16- email : user . email ,
17- password : password
18- } ,
19- format : format
20- }
21- )
13+ post ( :create , params : {
14+ spree_user : {
15+ email : user . email ,
16+ password : password
17+ } ,
18+ format : format
19+ } )
2220 end
2321
2422 context "when using correct login information" do
Original file line number Diff line number Diff line change 22
33RSpec . feature 'Admin - Sign In' , type : :feature do
44 background do
5- @user = create ( :user , email : 'email@person.com' )
5+ @user = create ( :admin_user , email : 'email@person.com' )
66 visit spree . admin_login_path
77 end
88
1919 expect ( page ) . to have_text 'Logged in successfully'
2020 expect ( page ) . not_to have_text 'Login'
2121 expect ( page ) . to have_text 'Logout'
22- expect ( current_path ) . to eq '/'
22+ expect ( current_path ) . to eq '/admin/orders '
2323 end
2424
2525 scenario 'shows validation erros' do
You can’t perform that action at this time.
0 commit comments