X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/12c1d5e6c05813a0697724277b4d8529a1a7c240..c816efc3862ddcdb8fa5e9f14a8b13ff98fdeae6:/test/factories/user.rb diff --git a/test/factories/user.rb b/test/factories/user.rb index cdc606cf1..7f1f14e9c 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -1,8 +1,10 @@ +pass_crypt = PasswordHash.create("test").first + 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 { pass_crypt } # These attributes are not the defaults, but in most tests we want # a 'normal' user who can log in without being redirected etc. @@ -47,6 +49,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)