Chatwoot/spec/factories/users.rb

31 lines
663 B
Ruby
Raw Normal View History

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