summaryrefslogtreecommitdiff
path: root/spec/helpers/namespaces_helper_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-01 12:05:46 -0700
committerStan Hu <stanhu@gmail.com>2018-08-01 12:05:46 -0700
commit075ee4780e8069728d3836140e099fc5226be435 (patch)
tree2adf867d7f3735c7f31cc826f78b7bcb71b98fb1 /spec/helpers/namespaces_helper_spec.rb
parentaa5821e571620e09229721a1a235d93a554db6a3 (diff)
downloadgitlab-ce-075ee4780e8069728d3836140e099fc5226be435.tar.gz
Fix selection of existing project key by default
Diffstat (limited to 'spec/helpers/namespaces_helper_spec.rb')
-rw-r--r--spec/helpers/namespaces_helper_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/helpers/namespaces_helper_spec.rb b/spec/helpers/namespaces_helper_spec.rb
index 78bc5ff0055..234690e742b 100644
--- a/spec/helpers/namespaces_helper_spec.rb
+++ b/spec/helpers/namespaces_helper_spec.rb
@@ -40,7 +40,7 @@ describe NamespacesHelper do
expect(options).to include(admin_group.name)
end
- it 'selects extra_group' do
+ it 'selects existing group' do
allow(helper).to receive(:current_user).and_return(admin)
options = helper.namespaces_options(:extra_group, display_path: true, extra_group: user_group)
@@ -49,6 +49,16 @@ describe NamespacesHelper do
expect(options).to include(admin_group.name)
end
+ it 'selects the new group by default' do
+ 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'))
+
+ expect(options).to include(user_group.name)
+ expect(options).not_to include(admin_group.name)
+ expect(options).to include("selected=\"selected\" value=\"-1\"")
+ end
+
it 'falls back to current user selection' do
allow(helper).to receive(:current_user).and_return(user)