summaryrefslogtreecommitdiff
path: root/spec/factories/namespaces.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/factories/namespaces.rb
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
downloadgitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/factories/namespaces.rb')
-rw-r--r--spec/factories/namespaces.rb17
1 files changed, 1 insertions, 16 deletions
diff --git a/spec/factories/namespaces.rb b/spec/factories/namespaces.rb
index f4b57369678..957ec88420d 100644
--- a/spec/factories/namespaces.rb
+++ b/spec/factories/namespaces.rb
@@ -5,22 +5,7 @@ FactoryBot.define do
sequence(:name) { |n| "namespace#{n}" }
path { name.downcase.gsub(/\s/, '_') }
- # This is a workaround to avoid the user creating another namespace via
- # User#ensure_namespace_correct. We should try to remove it and then
- # we could remove this workaround
- association :owner, factory: :user, strategy: :build
- before(:create) do |namespace|
- owner = namespace.owner
-
- if owner
- # We're changing the username here because we want to keep our path,
- # and User#ensure_namespace_correct would change the path based on
- # username, so we're forced to do this otherwise we'll need to change
- # a lot of existing tests.
- owner.username = namespace.path
- owner.namespace = namespace
- end
- end
+ owner { association(:user, strategy: :build, namespace: instance, username: path) }
trait :with_aggregation_schedule do
after(:create) do |namespace|