Remove unused devise session controller

This commit is contained in:
simon lehericey 2019-08-08 10:19:47 +02:00 committed by Pierre de La Morinerie
parent a57574054a
commit a4b9eecded
8 changed files with 2 additions and 115 deletions

View file

@ -1,13 +0,0 @@
class Administrateurs::SessionsController < Sessions::SessionsController
def new
redirect_to new_user_session_path
end
def create
super
end
def after_sign_in_path_for(resource)
admin_procedures_path
end
end

View file

@ -119,7 +119,7 @@ module Instructeurs
elsif avis.instructeur&.email == params[:email]
# the avis instructeur has already signed up and it sould sign in
redirect_to new_instructeur_session_url
redirect_to new_user_session_url
end
end

View file

@ -1,9 +0,0 @@
class Instructeurs::SessionsController < Sessions::SessionsController
def new
redirect_to new_user_session_path
end
def create
super
end
end

View file

@ -78,12 +78,10 @@ Rails.application.routes.draw do
}
devise_for :administrateurs, controllers: {
sessions: 'administrateurs/sessions',
passwords: 'administrateurs/passwords'
}, skip: [:registrations]
devise_for :instructeurs, controllers: {
sessions: 'instructeurs/sessions',
passwords: 'instructeurs/passwords'
}, skip: [:registrations]

View file

@ -1,11 +0,0 @@
require 'spec_helper'
describe Administrateurs::SessionsController, type: :controller do
before do
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
end
describe '#create' do
it { expect(described_class).to be < Sessions::SessionsController }
end
end

View file

@ -229,7 +229,7 @@ describe Instructeurs::AvisController, type: :controller do
get :sign_up, params: { id: avis.id, email: invited_email }
end
it { is_expected.to redirect_to new_instructeur_session_url }
it { is_expected.to redirect_to new_user_session_url }
end
end

View file

@ -1,11 +0,0 @@
require 'spec_helper'
describe Instructeurs::SessionsController, type: :controller do
before do
@request.env["devise.mapping"] = Devise.mappings[:instructeur]
end
describe '#create' do
it { expect(described_class).to be < Sessions::SessionsController }
end
end

View file

@ -1,67 +0,0 @@
require 'spec_helper'
feature 'Administrator connection' do
include ActiveJob::TestHelper
let(:email) { 'admin1@admin.com' }
let(:password) { 'mon chien aime les bananes' }
let!(:admin) { create(:administrateur, :with_procedure, email: email, password: password) }
let!(:user) { create(:user, email: email, password: password) }
before do
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
visit new_administrateur_session_path
end
scenario 'administrator is on sign in page' do
expect(page).to have_css('#new_user')
end
context "admin fills form and log in" do
before do
sign_in_with(email, password, true)
end
scenario 'a menu button is available' do
expect(page).to have_css('#admin_menu')
end
context 'when he click on the menu' do
before do
page.find_by_id('admin_menu').click
end
scenario 'it displays the menu' do
expect(page).to have_css('a#profile')
expect(page).to have_css('#sign-out')
end
context 'when clicking on sign-out' do
before do
stub_request(:get, "https://api.github.com/repos/betagouv/tps/releases/latest")
.to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
page.find_by_id('sign-out').find('a').click
end
scenario 'admin is redireted to home page' do
expect(page).to have_css('.landing')
end
end
context 'when clicking on profile' do
before do
page.find_by_id('profile').click
end
scenario 'it redirects to profile page' do
expect(page).to have_css('#profil-page')
end
context 'when clicking on procedure' do
before do
page.click_on('Tableau de bord').click
end
scenario 'it redirects to procedure page' do
expect(page).to have_content('Démarches')
end
end
end
end
end
end