Remove demo accounts routes
This commit is contained in:
parent
95b6ec2899
commit
b187e7163a
8 changed files with 3 additions and 98 deletions
|
@ -1,13 +1,6 @@
|
|||
class Administrateurs::SessionsController < Sessions::SessionsController
|
||||
layout "new_application"
|
||||
|
||||
def demo
|
||||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
@user = User.new(email: DemoEmails[:admin], password: 'password')
|
||||
render 'users/sessions/new'
|
||||
end
|
||||
|
||||
def new
|
||||
redirect_to new_user_session_path
|
||||
end
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
class Gestionnaires::SessionsController < Sessions::SessionsController
|
||||
layout "new_application"
|
||||
|
||||
def demo
|
||||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
@user = User.new(email: DemoEmails[:gestionnaire], password: 'password')
|
||||
render 'users/sessions/new'
|
||||
end
|
||||
|
||||
def new
|
||||
redirect_to new_user_session_path
|
||||
end
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
class Users::SessionsController < Sessions::SessionsController
|
||||
layout "new_application"
|
||||
|
||||
# before_action :configure_sign_in_params, only: [:create]
|
||||
|
||||
def demo
|
||||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
@user = User.new(email: DemoEmails[:user], password: 'password')
|
||||
render 'new'
|
||||
end
|
||||
|
||||
# GET /resource/sign_in
|
||||
def new
|
||||
unless user_return_to_procedure_id.nil? # WTF ?
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
DemoEmails = {
|
||||
user: 'demo@tps.fr',
|
||||
gestionnaire: 'gestionnaire@apientreprise.fr',
|
||||
admin: 'admin@tps.fr'
|
||||
}
|
|
@ -19,12 +19,12 @@ Rails.application.routes.draw do
|
|||
}
|
||||
|
||||
devise_scope :user do
|
||||
get '/users/sign_in/demo' => 'users/sessions#demo'
|
||||
get '/users/sign_in/demo' => redirect("/users/sign_in")
|
||||
get '/users/no_procedure' => 'users/sessions#no_procedure'
|
||||
end
|
||||
|
||||
devise_scope :gestionnaire do
|
||||
get '/gestionnaires/sign_in/demo' => 'gestionnaires/sessions#demo'
|
||||
get '/gestionnaires/sign_in/demo' => redirect("/users/sign_in")
|
||||
get '/gestionnaires/edit' => 'gestionnaires/registrations#edit', :as => 'edit_gestionnaires_registration'
|
||||
put '/gestionnaires' => 'gestionnaires/registrations#update', :as => 'gestionnaires_registration'
|
||||
end
|
||||
|
@ -33,7 +33,7 @@ Rails.application.routes.draw do
|
|||
post 'avis/:id/sign_up/email/:email' => 'backoffice/avis#create_gestionnaire', constraints: { email: /.*/ }
|
||||
|
||||
devise_scope :administrateur do
|
||||
get '/administrateurs/sign_in/demo' => 'administrateurs/sessions#demo'
|
||||
get '/administrateurs/sign_in/demo' => redirect("/users/sign_in")
|
||||
end
|
||||
|
||||
root 'root#index'
|
||||
|
|
|
@ -5,29 +5,6 @@ describe Administrateurs::SessionsController, type: :controller do
|
|||
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
||||
end
|
||||
|
||||
describe '.demo' do
|
||||
subject { get :demo }
|
||||
render_views
|
||||
|
||||
context 'when rails env is production' do
|
||||
before do
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to root_path }
|
||||
end
|
||||
|
||||
context 'when rails env is not production' do
|
||||
it { expect(subject.status).to eq 200 }
|
||||
|
||||
it 'Administrateur demo is initiated' do
|
||||
subject
|
||||
expect(response.body).to have_css("input#user_email[value='admin@tps.fr']")
|
||||
expect(response.body).to have_css("input#user_password[value='password']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.create' do
|
||||
it { expect(described_class).to be < Sessions::SessionsController }
|
||||
end
|
||||
|
|
|
@ -5,29 +5,6 @@ describe Gestionnaires::SessionsController, type: :controller do
|
|||
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
||||
end
|
||||
|
||||
describe '.demo' do
|
||||
subject { get :demo }
|
||||
render_views
|
||||
|
||||
context 'when rails env is production' do
|
||||
before do
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to root_path }
|
||||
end
|
||||
|
||||
context 'when rails env is not production' do
|
||||
it { expect(subject.status).to eq 200 }
|
||||
|
||||
it 'Gestionnaire demo is initiated' do
|
||||
subject
|
||||
expect(response.body).to have_css("input#user_email[value='gestionnaire@apientreprise.fr']")
|
||||
expect(response.body).to have_css("input#user_password[value='password']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.create' do
|
||||
it { expect(described_class).to be < Sessions::SessionsController }
|
||||
end
|
||||
|
|
|
@ -8,27 +8,6 @@ describe Users::SessionsController, type: :controller do
|
|||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
end
|
||||
|
||||
describe '.demo' do
|
||||
subject { get :demo }
|
||||
|
||||
context 'when rails env is production' do
|
||||
before do
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to root_path }
|
||||
end
|
||||
|
||||
context 'when rails env is not production' do
|
||||
it { expect(subject.status).to eq 200 }
|
||||
|
||||
it 'User demo is initiated' do
|
||||
expect(User).to receive(:new).with(email: 'demo@tps.fr', password: 'password').and_return(User)
|
||||
subject
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.create' do
|
||||
it { expect(described_class).to be < Sessions::SessionsController }
|
||||
|
||||
|
|
Loading…
Reference in a new issue