Welcome to mirror list, hosted at ThFree Co, Russian Federation.

organizations.rb « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ff0493d140b293b0e35f62accbc43201c30ee42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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