From 2b321a3979598393fc528d60d01e5eaf95e35db8 Mon Sep 17 00:00:00 2001
From: Mark Chao <mchao@gitlab.com>
Date: Wed, 15 Sep 2021 15:36:48 +0800
Subject: [PATCH] Convenience metadata to stub gitlab.com

Ensure GitlabSubscription factory is only used under .com
---
 ee/spec/factories/gitlab_subscriptions.rb | 4 ++++
 ee/spec/factories/groups.rb               | 2 +-
 ee/spec/factories/namespaces.rb           | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ee/spec/factories/gitlab_subscriptions.rb b/ee/spec/factories/gitlab_subscriptions.rb
index d4e49131c4e..78d3e59d1a7 100644
--- a/ee/spec/factories/gitlab_subscriptions.rb
+++ b/ee/spec/factories/gitlab_subscriptions.rb
@@ -2,6 +2,10 @@
 
 FactoryBot.define do
   factory :gitlab_subscription do
+    after(:build) do
+      raise 'not under .com' unless Gitlab.com?
+    end
+
     namespace
     association :hosted_plan, factory: :ultimate_plan
     seats { 10 }
diff --git a/ee/spec/factories/groups.rb b/ee/spec/factories/groups.rb
index 40115400fc4..282e22d1e61 100644
--- a/ee/spec/factories/groups.rb
+++ b/ee/spec/factories/groups.rb
@@ -73,7 +73,7 @@ FactoryBot.define do
 
   factory :group_with_plan, parent: :group do
     transient do
-      plan { :default_plan }
+      plan { :free_plan }
       trial_ends_on { nil }
     end
 
diff --git a/ee/spec/factories/namespaces.rb b/ee/spec/factories/namespaces.rb
index aa21c6fdda4..3143d9da27d 100644
--- a/ee/spec/factories/namespaces.rb
+++ b/ee/spec/factories/namespaces.rb
@@ -47,7 +47,7 @@ end
 FactoryBot.define do
   factory :namespace_with_plan, parent: :namespace do
     transient do
-      plan { :default_plan }
+      plan { :free_plan }
       trial_ends_on { nil }
     end
 
-- 
2.30.9