Files
danbooru/test/factories/user.rb
evazion 258f4a8b95 users: move emails to separate table.
* Move emails from users table to email_addresses table.
* Validate that addresses are formatted correctly and are unique across
  users. Existing invalid emails are grandfathered in.
* Add is_verified flag (the address has been confirmed by the user).
* Add is_deliverable flag (an undeliverable address is an address that bounces).
* Normalize addresses to prevent registering multiple accounts with the
  same email address (using tricks like Gmail's plus addressing).
2020-03-12 21:18:53 -05:00

71 lines
1.2 KiB
Ruby

FactoryBot.define do
factory(:user, aliases: [:creator, :updater]) do
sequence :name do |n|
"user#{n}"
end
password {"password"}
default_image_size {"large"}
level {20}
created_at {Time.now}
last_logged_in_at {Time.now}
favorite_count {0}
bit_prefs {0}
last_forum_read_at {nil}
factory(:banned_user) do
transient { ban_duration {3} }
is_banned {true}
end
factory(:member_user) do
level {20}
end
factory(:gold_user) do
level {30}
end
factory(:platinum_user) do
level {31}
end
factory(:builder_user) do
level {32}
end
factory(:contributor_user) do
level {32}
can_upload_free {true}
end
factory(:contrib_user) do
level {32}
can_upload_free {true}
end
factory(:moderator_user) do
level {40}
can_approve_posts {true}
end
factory(:mod_user) do
level {40}
can_approve_posts {true}
end
factory(:admin_user) do
level {50}
can_approve_posts {true}
end
factory(:uploader) do
created_at { 2.weeks.ago }
end
factory(:approver) do
level {32}
can_approve_posts {true}
end
end
end