3 sequence(:email) { |n| "user#{n}@example.com" }
4 sequence(:display_name) { |n| "User #{n}" }
5 pass_crypt { PasswordHash.create("test").first }
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.
9 after(:build) do |user, _evaluator|
14 terms_agreed { Time.now.utc }
17 trait :with_home_location do
18 home_lat { rand(-90.0...90.0) }
19 home_lon { rand(-180.0...180.0) }
23 after(:build) do |user, _evaluator|
33 after(:build) do |user, _evaluator|
39 after(:build) do |user, _evaluator|
45 after(:build) do |user, _evaluator|
50 factory :importer_user do
51 after(:create) do |user, _evaluator|
52 create(:user_role, :role => "importer", :user => user)
56 factory :moderator_user do
57 after(:create) do |user, _evaluator|
58 create(:user_role, :role => "moderator", :user => user)
62 factory :administrator_user do
63 after(:create) do |user, _evaluator|
64 create(:user_role, :role => "administrator", :user => user)
68 factory :super_user do
69 after(:create) do |user, _evaluator|
70 UserRole::ALL_ROLES.each do |role|
71 create(:user_role, :role => role, :user => user)