Skip to content

Commit

Permalink
User seed migration authenticates admin user
Browse files Browse the repository at this point in the history
Sends invitation, accepts invitation.

Now you can log in with `[email protected]` and `password`.
  • Loading branch information
ivankocienski committed Jan 31, 2023
1 parent f93b87f commit cdb3304
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions db/seeds/001_users.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# frozen_string_literal: true

User.find_or_create_by!(
email: '[email protected]'
) do |user|
user.password = 'password'
user.password_confirmation = 'password'
end.update!(
role: :root
)
module UserSeeder
module_function

def run
user = User.find_or_create_by!(email: '[email protected]') do |u|
u.password = 'password'
u.password_confirmation = 'password'
u.role = :root
end

user.invite!
user.accept_invitation!
end
end

UserSeeder.run

0 comments on commit cdb3304

Please sign in to comment.