Merge pull request #941 from sgmap/remove_demo_accounts_routes
Remove demo accounts routes
This commit is contained in:
commit
4dd61f73cf
8 changed files with 3 additions and 98 deletions
|
@ -1,13 +1,6 @@
|
||||||
class Administrateurs::SessionsController < Sessions::SessionsController
|
class Administrateurs::SessionsController < Sessions::SessionsController
|
||||||
layout "new_application"
|
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
|
def new
|
||||||
redirect_to new_user_session_path
|
redirect_to new_user_session_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
class Gestionnaires::SessionsController < Sessions::SessionsController
|
class Gestionnaires::SessionsController < Sessions::SessionsController
|
||||||
layout "new_application"
|
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
|
def new
|
||||||
redirect_to new_user_session_path
|
redirect_to new_user_session_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
class Users::SessionsController < Sessions::SessionsController
|
class Users::SessionsController < Sessions::SessionsController
|
||||||
layout "new_application"
|
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
|
# GET /resource/sign_in
|
||||||
def new
|
def new
|
||||||
unless user_return_to_procedure_id.nil? # WTF ?
|
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
|
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'
|
get '/users/no_procedure' => 'users/sessions#no_procedure'
|
||||||
end
|
end
|
||||||
|
|
||||||
devise_scope :gestionnaire do
|
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'
|
get '/gestionnaires/edit' => 'gestionnaires/registrations#edit', :as => 'edit_gestionnaires_registration'
|
||||||
put '/gestionnaires' => 'gestionnaires/registrations#update', :as => 'gestionnaires_registration'
|
put '/gestionnaires' => 'gestionnaires/registrations#update', :as => 'gestionnaires_registration'
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ Rails.application.routes.draw do
|
||||||
post 'avis/:id/sign_up/email/:email' => 'backoffice/avis#create_gestionnaire', constraints: { email: /.*/ }
|
post 'avis/:id/sign_up/email/:email' => 'backoffice/avis#create_gestionnaire', constraints: { email: /.*/ }
|
||||||
|
|
||||||
devise_scope :administrateur do
|
devise_scope :administrateur do
|
||||||
get '/administrateurs/sign_in/demo' => 'administrateurs/sessions#demo'
|
get '/administrateurs/sign_in/demo' => redirect("/users/sign_in")
|
||||||
end
|
end
|
||||||
|
|
||||||
root 'root#index'
|
root 'root#index'
|
||||||
|
|
|
@ -5,29 +5,6 @@ describe Administrateurs::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
@request.env["devise.mapping"] = Devise.mappings[:administrateur]
|
||||||
end
|
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
|
describe '.create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,29 +5,6 @@ describe Gestionnaires::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
||||||
end
|
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
|
describe '.create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,27 +8,6 @@ describe Users::SessionsController, type: :controller do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
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
|
describe '.create' do
|
||||||
it { expect(described_class).to be < Sessions::SessionsController }
|
it { expect(described_class).to be < Sessions::SessionsController }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue