1 pass_crypt = PasswordHash.create("test").first
5 sequence(:email) { |n| "user#{n}@example.com" }
6 sequence(:display_name) { |n| "User #{n}" }
7 pass_crypt { pass_crypt }
9 # These attributes are not the defaults, but in most tests we want
10 # a 'normal' user who can log in without being redirected etc.
11 after(:build) do |user, _evaluator|
16 terms_agreed { Time.now.utc }
19 trait :with_home_location do
20 home_lat { rand(-90.0...90.0) }
21 home_lon { rand(-180.0...180.0) }
25 after(:build) do |user, _evaluator|
35 after(:build) do |user, _evaluator|
41 after(:build) do |user, _evaluator|
47 after(:build) do |user, _evaluator|
52 factory :importer_user do
53 after(:create) do |user, _evaluator|
54 create(:user_role, :role => "importer", :user => user)
58 factory :moderator_user do
59 after(:create) do |user, _evaluator|
60 create(:user_role, :role => "moderator", :user => user)
64 factory :administrator_user do
65 after(:create) do |user, _evaluator|
66 create(:user_role, :role => "administrator", :user => user)
70 factory :super_user do
71 after(:create) do |user, _evaluator|
72 UserRole::ALL_ROLES.each do |role|
73 create(:user_role, :role => role, :user => user)