* Add Settings::Mascot * Add DUS * Update usage * Fix e2e test and controller * Fix specs * Fix remaining spec
29 lines
688 B
Ruby
29 lines
688 B
Ruby
module Users
|
|
class CreateMascotAccount
|
|
MASCOT_PARAMS = {
|
|
email: "mascot@forem.com",
|
|
username: "mascot",
|
|
name: "Mascot",
|
|
profile_image: Settings::Mascot.image_url,
|
|
confirmed_at: Time.current,
|
|
registered_at: Time.current,
|
|
password: SecureRandom.hex
|
|
}.freeze
|
|
|
|
def self.call
|
|
new.call
|
|
end
|
|
|
|
def call
|
|
raise "Mascot already set" if Settings::Mascot.mascot_user_id
|
|
|
|
mascot = User.create!(mascot_params)
|
|
Settings::Mascot.mascot_user_id = mascot.id
|
|
end
|
|
|
|
def mascot_params
|
|
# Set the password_confirmation
|
|
MASCOT_PARAMS.merge(password_confirmation: MASCOT_PARAMS[:password])
|
|
end
|
|
end
|
|
end
|