Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
36
research/chatwoot/spec/factories/users.rb
Normal file
36
research/chatwoot/spec/factories/users.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :user do
|
||||
transient do
|
||||
skip_confirmation { true }
|
||||
role { 'agent' }
|
||||
auto_offline { true }
|
||||
account { nil }
|
||||
inviter { nil }
|
||||
end
|
||||
|
||||
provider { 'email' }
|
||||
uid { SecureRandom.uuid }
|
||||
name { Faker::Name.name }
|
||||
display_name { Faker::Name.first_name }
|
||||
email { display_name + "@#{SecureRandom.uuid}.com" }
|
||||
password { 'Password1!' }
|
||||
|
||||
after(:build) do |user, evaluator|
|
||||
user.skip_confirmation! if evaluator.skip_confirmation
|
||||
if evaluator.account
|
||||
create(:account_user, user: user, account: evaluator.account, role: evaluator.role, inviter: evaluator.inviter,
|
||||
auto_offline: evaluator.auto_offline)
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_avatar do
|
||||
avatar { fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png') }
|
||||
end
|
||||
|
||||
trait :administrator do
|
||||
role { 'administrator' }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user