X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2fabc46421f9e908ef6902ea7c4890a0032af446..fa55f3878abe64a2402e2776e60953ed6af8f16e:/test/factories/user.rb diff --git a/test/factories/user.rb b/test/factories/user.rb index 07f1ef679..5b92345c2 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } sequence(:display_name) { |n| "User #{n}" } - pass_crypt { Digest::MD5.hexdigest("test") } + pass_crypt { PasswordHash.create("test").first } # These attributes are not the defaults, but in most tests we want # a 'normal' user who can log in without being redirected etc. @@ -11,7 +11,7 @@ FactoryBot.define do end terms_seen { true } - terms_agreed { Time.now.getutc } + terms_agreed { Time.now.utc } data_public { true } trait :with_home_location do @@ -47,6 +47,12 @@ FactoryBot.define do end end + factory :importer_user do + after(:create) do |user, _evaluator| + create(:user_role, :role => "importer", :user => user) + end + end + factory :moderator_user do after(:create) do |user, _evaluator| create(:user_role, :role => "moderator", :user => user)