Merge pull request #469 from sgmap/468_fix_demo_login
468 fix demo login
This commit is contained in:
commit
1fbfe917c4
5 changed files with 15 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
class Administrateurs::SessionsController < Sessions::SessionsController
|
||||
layout "new_application"
|
||||
|
||||
def demo
|
||||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class Gestionnaires::SessionsController < Sessions::SessionsController
|
||||
layout "new_application"
|
||||
|
||||
def demo
|
||||
return redirect_to root_path if Rails.env.production?
|
||||
|
||||
|
|
|
@ -31,8 +31,10 @@
|
|||
|
||||
= f.label :password, "Mot de passe"
|
||||
= f.password_field :password, value: @user.password, placeholder: "8 caractères minimum"
|
||||
.reset-password.text-right
|
||||
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "link"
|
||||
|
||||
- if [:user, :gestionnaire].include?(resource_name)
|
||||
.reset-password.text-right
|
||||
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "link"
|
||||
|
||||
- if devise_mapping.rememberable?
|
||||
= f.check_box :remember_me, as: :boolean
|
||||
|
@ -50,7 +52,7 @@
|
|||
.center
|
||||
= link_to "Qu’est-ce que FranceConnect ?", "https://franceconnect.gouv.fr/", target: "_blank", class: "link"
|
||||
|
||||
- if devise_mapping.registerable?
|
||||
- if resource_name == :user
|
||||
%hr
|
||||
%p.register
|
||||
%span
|
||||
|
|
|
@ -7,6 +7,7 @@ describe Administrateurs::SessionsController, type: :controller do
|
|||
|
||||
describe '.demo' do
|
||||
subject { get :demo }
|
||||
render_views
|
||||
|
||||
context 'when rails env is production' do
|
||||
before do
|
||||
|
@ -20,8 +21,9 @@ describe Administrateurs::SessionsController, type: :controller do
|
|||
it { expect(subject.status).to eq 200 }
|
||||
|
||||
it 'Administrateur demo is initiated' do
|
||||
expect(User).to receive(:new).with(email: 'admin@tps.fr', password: 'password').and_return(Administrateur)
|
||||
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
|
||||
|
|
|
@ -7,6 +7,7 @@ describe Gestionnaires::SessionsController, type: :controller do
|
|||
|
||||
describe '.demo' do
|
||||
subject { get :demo }
|
||||
render_views
|
||||
|
||||
context 'when rails env is production' do
|
||||
before do
|
||||
|
@ -20,8 +21,9 @@ describe Gestionnaires::SessionsController, type: :controller do
|
|||
it { expect(subject.status).to eq 200 }
|
||||
|
||||
it 'Gestionnaire demo is initiated' do
|
||||
expect(User).to receive(:new).with(email: 'gestionnaire@apientreprise.fr', password: 'password').and_return(Gestionnaire)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue