summaryrefslogtreecommitdiff
path: root/spec/factories/groups.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-04-23 15:48:26 +0000
committerNick Thomas <nick@gitlab.com>2018-04-23 15:48:26 +0000
commitab286656b22dd686a659afe908daade6e5a54ff3 (patch)
tree538fb10cb2979c616754e492d8fe44500e760a37 /spec/factories/groups.rb
parent3d12ce95b1307f9b8439aab9ac5fe9d406ab9b01 (diff)
downloadgitlab-ce-ab286656b22dd686a659afe908daade6e5a54ff3.tar.gz
Resolve "Namespace factory is problematic"
Diffstat (limited to 'spec/factories/groups.rb')
-rw-r--r--spec/factories/groups.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb
index 8c531cf5909..3b354c0d96b 100644
--- a/spec/factories/groups.rb
+++ b/spec/factories/groups.rb
@@ -5,6 +5,14 @@ FactoryBot.define do
type 'Group'
owner nil
+ after(:create) do |group|
+ if group.owner
+ # We could remove this after we have proper constraint:
+ # https://gitlab.com/gitlab-org/gitlab-ce/issues/43292
+ raise "Don't set owner for groups, use `group.add_owner(user)` instead"
+ end
+ end
+
trait :public do
visibility_level Gitlab::VisibilityLevel::PUBLIC
end