instructeurs: fix expert creation not to use Instructeur.email
It kind of worked until now, because the email field is disabled, and thus never accessed. But better make it clean, by accessing an object (User) where the email field actually exists.
This commit is contained in:
parent
38f994a151
commit
d78d206544
4 changed files with 4 additions and 4 deletions
|
@ -81,7 +81,7 @@ module Instructeurs
|
||||||
|
|
||||||
def create_instructeur
|
def create_instructeur
|
||||||
email = params[:email]
|
email = params[:email]
|
||||||
password = params['instructeur']['password']
|
password = params[:user][:password]
|
||||||
|
|
||||||
# Not perfect because the password will not be changed if the user already exists
|
# Not perfect because the password will not be changed if the user already exists
|
||||||
user = User.create_or_promote_to_instructeur(email, password)
|
user = User.create_or_promote_to_instructeur(email, password)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
%p.description= @dossier.procedure.libelle
|
%p.description= @dossier.procedure.libelle
|
||||||
%p.dossier Dossier nº #{@dossier.id}
|
%p.dossier Dossier nº #{@dossier.id}
|
||||||
.column
|
.column
|
||||||
= form_for(Instructeur.new, url: { controller: "instructeurs/avis", action: :create_instructeur }, method: :post, html: { class: "form" }) do |f|
|
= form_for(User.new, url: { controller: "instructeurs/avis", action: :create_instructeur }, method: :post, html: { class: "form" }) do |f|
|
||||||
%h1 Créez-vous un compte
|
%h1 Créez-vous un compte
|
||||||
|
|
||||||
= f.label :email, "Email"
|
= f.label :email, "Email"
|
||||||
|
|
|
@ -296,7 +296,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
post :create_instructeur, params: {
|
post :create_instructeur, params: {
|
||||||
id: avis_id,
|
id: avis_id,
|
||||||
email: invited_email,
|
email: invited_email,
|
||||||
instructeur: {
|
user: {
|
||||||
password: password
|
password: password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ feature 'Instructing a dossier:' do
|
||||||
|
|
||||||
def avis_sign_up(avis, email)
|
def avis_sign_up(avis, email)
|
||||||
visit sign_up_instructeur_avis_path(avis, email)
|
visit sign_up_instructeur_avis_path(avis, email)
|
||||||
fill_in 'instructeur_password', with: 'démarches-simplifiées-pwd'
|
fill_in 'user_password', with: 'démarches-simplifiées-pwd'
|
||||||
click_on 'Créer un compte'
|
click_on 'Créer un compte'
|
||||||
expect(page).to have_current_path(instructeur_avis_index_path)
|
expect(page).to have_current_path(instructeur_avis_index_path)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue