Remove useless sessions_controller
This commit is contained in:
parent
2d9569d30d
commit
972b6793f7
3 changed files with 1 additions and 59 deletions
|
@ -1,23 +0,0 @@
|
|||
class Sessions::SessionsController < Devise::SessionsController
|
||||
before_action :before_sign_in, only: [:create]
|
||||
|
||||
layout 'new_application'
|
||||
|
||||
def before_sign_in
|
||||
if user_signed_in?
|
||||
sign_out :user
|
||||
end
|
||||
|
||||
if instructeur_signed_in?
|
||||
sign_out :instructeur
|
||||
end
|
||||
|
||||
if administrateur_signed_in?
|
||||
sign_out :administrateur
|
||||
end
|
||||
|
||||
if administration_signed_in?
|
||||
sign_out :administration
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Users::SessionsController < Sessions::SessionsController
|
||||
class Users::SessionsController < Devise::SessionsController
|
||||
include ProcedureContextConcern
|
||||
include TrustedDeviceConcern
|
||||
include ActionView::Helpers::DateHelper
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Sessions::SessionsController, type: :controller do
|
||||
controller Sessions::SessionsController do
|
||||
def create
|
||||
render json: ''
|
||||
end
|
||||
end
|
||||
|
||||
let(:user) { create(:user) }
|
||||
|
||||
describe '#create' do
|
||||
before do
|
||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
end
|
||||
|
||||
it 'calls before_sign_in' do
|
||||
expect_any_instance_of(Sessions::SessionsController).to receive(:before_sign_in)
|
||||
post :create
|
||||
end
|
||||
end
|
||||
|
||||
describe '#create with user connected' do
|
||||
before do
|
||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
|
||||
allow_any_instance_of(described_class).to receive(:user_signed_in?).and_return(true)
|
||||
end
|
||||
|
||||
it 'calls sign out for user' do
|
||||
expect_any_instance_of(described_class).to receive(:sign_out).with(:user)
|
||||
post :create
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue