2019-10-12 18:08:41 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :user do
|
2019-10-14 08:54:58 +00:00
|
|
|
transient do
|
|
|
|
skip_confirmation { true }
|
|
|
|
end
|
|
|
|
|
2019-10-12 18:08:41 +00:00
|
|
|
provider { 'email' }
|
|
|
|
uid { SecureRandom.uuid }
|
2019-10-16 21:48:07 +00:00
|
|
|
name { Faker::Name.name }
|
2019-10-20 08:47:26 +00:00
|
|
|
nickname { Faker::Name.first_name }
|
2019-10-14 08:54:58 +00:00
|
|
|
email { nickname + '@example.com' }
|
2019-10-12 18:08:41 +00:00
|
|
|
role { 'agent' }
|
2019-10-20 08:47:26 +00:00
|
|
|
password { 'password' }
|
2019-10-12 18:08:41 +00:00
|
|
|
account
|
2019-10-14 08:54:58 +00:00
|
|
|
|
|
|
|
after(:build) do |user, evaluator|
|
|
|
|
user.skip_confirmation! if evaluator.skip_confirmation
|
|
|
|
end
|
2019-12-10 04:59:35 +00:00
|
|
|
|
|
|
|
trait :with_avatar do
|
|
|
|
avatar { Rack::Test::UploadedFile.new('spec/assets/avatar.png', 'image/png') }
|
|
|
|
end
|
2019-12-27 19:57:59 +00:00
|
|
|
|
|
|
|
trait :administrator do
|
|
|
|
role { 'administrator' }
|
|
|
|
end
|
2019-10-12 18:08:41 +00:00
|
|
|
end
|
|
|
|
end
|