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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/organizations.rb')
-rw-r--r--spec/factories/organizations.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb
index a6684a8f95f..7ff0493d140 100644
--- a/spec/factories/organizations.rb
+++ b/spec/factories/organizations.rb
@@ -1,5 +1,16 @@
# frozen_string_literal: true
FactoryBot.define do
- factory :organization
+ 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