Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
67815272
Commit
67815272
authored
Oct 03, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return an empty array when no matches are found
parent
167fd713
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/concerns/group_descendant.rb
app/models/concerns/group_descendant.rb
+1
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+10
-0
No files found.
app/models/concerns/group_descendant.rb
View file @
67815272
...
...
@@ -6,7 +6,7 @@ module GroupDescendant
def
self
.
build_hierarchy
(
descendants
,
hierarchy_top
=
nil
)
descendants
=
Array
.
wrap
(
descendants
)
return
if
descendants
.
empty?
return
[]
if
descendants
.
empty?
unless
descendants
.
all?
{
|
hierarchy
|
hierarchy
.
is_a?
(
GroupDescendant
)
}
raise
ArgumentError
.
new
(
'element is not a hierarchy'
)
...
...
spec/controllers/groups_controller_spec.rb
View file @
67815272
...
...
@@ -331,6 +331,16 @@ describe GroupsController do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns an empty array when there are no search results'
do
subgroup
=
create
(
:group
,
:public
,
parent:
group
)
l2_subgroup
=
create
(
:group
,
:public
,
parent:
subgroup
)
create
(
:project
,
:public
,
namespace:
l2_subgroup
,
name:
'no-match'
)
get
:children
,
id:
subgroup
.
to_param
,
filter:
'test'
,
format: :json
expect
(
json_response
).
to
eq
([])
end
it
'includes pagination headers'
do
2
.
times
{
|
i
|
create
(
:group
,
:public
,
parent:
public_subgroup
,
name:
"filterme
#{
i
}
"
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment