dawarich/spec/factories/users.rb
2025-05-26 20:33:48 +02:00

55 lines
1.1 KiB
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :user do
sequence :email do |n|
"user#{n}@example.com"
end
status { :active }
active_until { 1000.years.from_now }
password { SecureRandom.hex(8) }
settings do
{
'route_opacity' => '0.5',
'meters_between_routes' => '100',
'minutes_between_routes' => '100',
'fog_of_war_meters' => '100',
'time_threshold_minutes' => '100',
'merge_threshold_minutes' => '100',
'maps' => {
'distance_unit' => 'km'
}
}
end
trait :admin do
admin { true }
end
trait :inactive do
status { :inactive }
active_until { 1.day.ago }
end
trait :with_immich_integration do
settings do
{
immich_url: 'https://immich.example.com',
immich_api_key: '1234567890'
}
end
end
trait :with_photoprism_integration do
settings do
{
photoprism_url: 'https://photoprism.example.com',
photoprism_api_key: '1234567890'
}
end
end
end
end