admin: create without providing email
This commit is contained in:
parent
2bb161c3cb
commit
ed970d3f3c
3 changed files with 3 additions and 4 deletions
|
@ -82,7 +82,7 @@ class User < ApplicationRecord
|
|||
user = User.create_or_promote_to_instructeur(email, password)
|
||||
|
||||
if user.valid? && user.administrateur_id.nil?
|
||||
user.create_administrateur!(email: email)
|
||||
user.create_administrateur!
|
||||
end
|
||||
|
||||
user
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
FactoryBot.define do
|
||||
sequence(:administrateur_email) { |n| "admin#{n}@admin.com" }
|
||||
factory :administrateur do
|
||||
email { generate(:administrateur_email) }
|
||||
|
||||
transient do
|
||||
email { generate(:administrateur_email) }
|
||||
password { 'mon chien aime les bananes' }
|
||||
end
|
||||
|
||||
|
|
|
@ -41,6 +41,6 @@ class AdministrationMailerPreview < ActionMailer::Preview
|
|||
end
|
||||
|
||||
def administrateur
|
||||
Administrateur.new(id: 111, email: "chef.de.service@administration.gouv.fr")
|
||||
Administrateur.new(id: 111, user: User.new(email: "chef.de.service@administration.gouv.fr"))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue