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:31:15 +0300
committerStan Hu <stanhu@gmail.com>2018-07-31 22:31:15 +0300
commit852b5613c5eda43a9dce20ca9a71301f5630b1c6 (patch)
tree8c9d347a4c7f37a25ce337f134e6c1c0b91c0224 /spec/helpers
parent0085b76fb387237af02f717a894c89f7227cb81e (diff)
Fix namespaces_helper reporting multiple groups
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/namespaces_helper_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/helpers/namespaces_helper_spec.rb b/spec/helpers/namespaces_helper_spec.rb
index 343e140f5fb..b12b2587510 100644
--- a/spec/helpers/namespaces_helper_spec.rb
+++ b/spec/helpers/namespaces_helper_spec.rb
@@ -31,6 +31,15 @@ describe NamespacesHelper do
expect(options).to include(user.name)
end
+ it 'avoids duplicate groups when extra_group is used' do
+ allow(helper).to receive(:current_user).and_return(admin)
+
+ options = helper.namespaces_options(user_group.id, display_path: true, extra_group: build(:group, name: admin_group.name))
+
+ expect(options.scan("data-name=\"#{admin_group.name}\"").count).to eq(1)
+ expect(options).to include(admin_group.name)
+ end
+
it 'returns only groups if groups_only option is true' do
allow(helper).to receive(:current_user).and_return(user)