Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-30 11:41:45 +0300
committerRémy Coutable <remy@rymai.me>2017-03-30 11:41:45 +0300
commit53ef1de4fcdc7ea0f94ae8fe73f9a2b46e376223 (patch)
treef465ad9e05aebdc173b311841896b6660256c52d /db/fixtures
parent68aa43fdbde279b2d990e4108da03c4e6bd8034d (diff)
Fix production admin fixture to use the new `Users::CreateService`
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/production/001_admin.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
index b37dc794015..1c7c89f7bbd 100644
--- a/db/fixtures/production/001_admin.rb
+++ b/db/fixtures/production/001_admin.rb
@@ -12,10 +12,12 @@ else
user_args[:password] = ENV['GITLAB_ROOT_PASSWORD']
end
-user = User.new(user_args)
-user.skip_confirmation!
+# Only admins can create other admin users in Users::CreateService so to solve
+# the chicken-and-egg problem, we pass a non-persisted admin user to the service.
+transient_admin = User.new(admin: true)
+user = Users::CreateService.new(transient_admin, user_args.merge!(skip_confirmation: true)).execute
-if user.save
+if user.persisted?
puts "Administrator account created:".color(:green)
puts
puts "login: root".color(:green)