Files
docuseal/spec/factories/accounts.rb
T

34 lines
824 B
Ruby
Raw Normal View History

2023-08-20 12:42:47 +03:00
# frozen_string_literal: true
FactoryBot.define do
factory :account do
name { Faker::Company.name }
locale { 'en-US' }
timezone { 'UTC' }
2024-12-10 23:18:07 +02:00
transient do
teams_count { 2 }
end
trait :with_testing_account do
after(:create) do |account|
testing_account = account.dup.tap { |a| a.name = "Testing - #{account.name}" }
testing_account.uuid = SecureRandom.uuid
account.testing_accounts << testing_account
account.save!
end
end
2024-12-10 23:18:07 +02:00
trait :with_teams do
after(:create) do |account, evaluator|
Array.new(evaluator.teams_count) do |i|
Account.create!(
name: "Team #{i}",
linked_account_account: AccountLinkedAccount.new(account_type: :linked, account:)
)
end
end
end
2023-08-20 12:42:47 +03:00
end
end