3 sequence(:email) { |n| "user#{n}@example.com" }
4 sequence(:display_name) { |n| "User #{n}" }
5 pass_crypt Digest::MD5.hexdigest("test")
7 # These attributes are not the defaults, but in most tests we want
8 # a 'normal' user who can log in without being redirected etc.
13 trait :with_home_location do
14 home_lat { rand(-90.0...90.0) }
15 home_lon { rand(-180.0...180.0) }
38 factory :moderator_user do
39 after(:create) do |user, _evaluator|
40 create(:user_role, :role => "moderator", :user => user)
44 factory :administrator_user do
45 after(:create) do |user, _evaluator|
46 create(:user_role, :role => "administrator", :user => user)
50 factory :super_user do
51 after(:create) do |user, _evaluator|
52 UserRole::ALL_ROLES.each do |role|
53 create(:user_role, :role => role, :user => user)