debian-mirror-gitlab/spec/factories/organizations.rb

17 lines
427 B
Ruby
Raw Normal View History

2023-07-09 08:55:56 +05:30
# frozen_string_literal: true
FactoryBot.define do
factory :organization do
sequence(:name) { |n| "Organization ##{n}" }
trait :default do
id { Organization::DEFAULT_ORGANIZATION_ID }
name { 'Default' }
initialize_with do
# Ensure we only use one default organization
Organization.find_by(id: Organization::DEFAULT_ORGANIZATION_ID) || new(**attributes)
end
end
end
end