diff options
author | Mark Fletcher <mark@gitlab.com> | 2017-12-20 12:17:39 +0000 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2017-12-20 19:34:50 +0000 |
commit | e7deeddc1b88a2809bd03dbcb876c5d460c297e5 (patch) | |
tree | c2887944c554f916dc26c3fa106a0098e9f1f8b8 /spec/finders/group_descendants_finder_spec.rb | |
parent | 225980db35cc468b892aa71d26aa622e5fe08b96 (diff) | |
download | gitlab-ce-e7deeddc1b88a2809bd03dbcb876c5d460c297e5.tar.gz |
Enable sorting by name in the Groups dropdown
Diffstat (limited to 'spec/finders/group_descendants_finder_spec.rb')
-rw-r--r-- | spec/finders/group_descendants_finder_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb index 074914420a1..ae050f36b4a 100644 --- a/spec/finders/group_descendants_finder_spec.rb +++ b/spec/finders/group_descendants_finder_spec.rb @@ -73,6 +73,41 @@ describe GroupDescendantsFinder do expect(finder.execute).to contain_exactly(matching_project) end end + + context 'sorting by name' do + let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') } + let!(:project2) { create(:project, namespace: group, name: 'z', path: 'project-z') } + let(:params) do + { + sort: 'name_asc' + } + end + + it 'sorts elements by name' do + expect(subject.execute).to eq( + [ + project1, + project2 + ] + ) + end + + context 'with nested groups', :nested_groups do + let!(:subgroup1) { create(:group, parent: group, name: 'a', path: 'sub-a') } + let!(:subgroup2) { create(:group, parent: group, name: 'z', path: 'sub-z') } + + it 'sorts elements by name' do + expect(subject.execute).to eq( + [ + subgroup1, + subgroup2, + project1, + project2 + ] + ) + end + end + end end context 'with nested groups', :nested_groups do |