summaryrefslogtreecommitdiff
path: root/spec/helpers/namespaces_helper_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-31 14:57:37 -0700
committerStan Hu <stanhu@gmail.com>2018-08-31 15:03:17 -0700
commit965f9113b05695236bb682dd7ff7cdb5a5232281 (patch)
treefe07899873009dfa8e0428898161c96540552752 /spec/helpers/namespaces_helper_spec.rb
parent472f2d566633df6c1dee1f703b06958b9a0a2cd8 (diff)
downloadgitlab-ce-965f9113b05695236bb682dd7ff7cdb5a5232281.tar.gz
Fix importers not assigning a new default group
The Bitbucket Server as well as other importers pass in a group name to be created (assuming the user has permission) and attempt to dedupe that with an existing group. However, the group *name* is not guaranteed to be unique, but the *path* is. Closes #50110
Diffstat (limited to 'spec/helpers/namespaces_helper_spec.rb')
-rw-r--r--spec/helpers/namespaces_helper_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/helpers/namespaces_helper_spec.rb b/spec/helpers/namespaces_helper_spec.rb
index 234690e742b..7ccbdcd1332 100644
--- a/spec/helpers/namespaces_helper_spec.rb
+++ b/spec/helpers/namespaces_helper_spec.rb
@@ -50,9 +50,12 @@ describe NamespacesHelper do
end
it 'selects the new group by default' do
+ # Ensure we don't select a group with the same name
+ create(:group, name: 'new-group', path: 'another-path')
+
allow(helper).to receive(:current_user).and_return(user)
- options = helper.namespaces_options(:extra_group, display_path: true, extra_group: build(:group, name: 'new-group'))
+ options = helper.namespaces_options(:extra_group, display_path: true, extra_group: build(:group, name: 'new-group', path: 'new-group'))
expect(options).to include(user_group.name)
expect(options).not_to include(admin_group.name)