Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-31 22:50:12 +0300
committerStan Hu <stanhu@gmail.com>2018-07-31 22:50:12 +0300
commit1528df0f514e8ac59d33054ef68c901eae2194eb (patch)
treef13e8a91ae196dd5237b5dc53cb6f648d6771b14 /spec/helpers
parent852b5613c5eda43a9dce20ca9a71301f5630b1c6 (diff)
Default to importing to the current project key
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/namespaces_helper_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/helpers/namespaces_helper_spec.rb b/spec/helpers/namespaces_helper_spec.rb
index b12b2587510..78bc5ff0055 100644
--- a/spec/helpers/namespaces_helper_spec.rb
+++ b/spec/helpers/namespaces_helper_spec.rb
@@ -40,6 +40,25 @@ describe NamespacesHelper do
expect(options).to include(admin_group.name)
end
+ it 'selects extra_group' do
+ allow(helper).to receive(:current_user).and_return(admin)
+
+ options = helper.namespaces_options(:extra_group, display_path: true, extra_group: user_group)
+
+ expect(options).to include("selected=\"selected\" value=\"#{user_group.id}\"")
+ expect(options).to include(admin_group.name)
+ end
+
+ it 'falls back to current user selection' do
+ allow(helper).to receive(:current_user).and_return(user)
+
+ options = helper.namespaces_options(:extra_group, display_path: true, extra_group: build(:group, name: admin_group.name))
+
+ expect(options).to include(user_group.name)
+ expect(options).not_to include(admin_group.name)
+ expect(options).to include("selected=\"selected\" value=\"#{user.namespace.id}\"")
+ end
+
it 'returns only groups if groups_only option is true' do
allow(helper).to receive(:current_user).and_return(user)