diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 774436d69..bd8525c0d 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -31,8 +31,7 @@ class Users::SessionsController < Devise::SessionsController redirect_to after_sign_in_path_for(:user) else flash.alert = 'Mauvais couple login / mot de passe' - new - render :new, status: 401 + render :new, assigns: { user: User.new } end end diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb index ad2907313..5e502cdcc 100644 --- a/spec/controllers/users/sessions_controller_spec.rb +++ b/spec/controllers/users/sessions_controller_spec.rb @@ -44,7 +44,7 @@ describe Users::SessionsController, type: :controller do it 'fails to sign in with bad credentials' do subject - expect(response.unauthorized?).to be(true) + expect(response).to render_template(:new) expect(controller.current_user).to be(nil) end end