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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9c256781
Commit
9c256781
authored
Jul 26, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GeoNode#project_ids should return nil when have no restrictions
parent
590a21e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/geo_node.rb
app/models/geo_node.rb
+1
-1
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+3
-3
No files found.
app/models/geo_node.rb
View file @
9c256781
...
@@ -109,7 +109,7 @@ class GeoNode < ActiveRecord::Base
...
@@ -109,7 +109,7 @@ class GeoNode < ActiveRecord::Base
end
end
def
project_ids
def
project_ids
return
[]
unless
groups
.
any?
return
unless
groups
.
any?
groups
.
flat_map
{
|
group
|
group
.
all_projects
.
pluck
(
:id
)
}.
uniq
groups
.
flat_map
{
|
group
|
group
.
all_projects
.
pluck
(
:id
)
}.
uniq
end
end
...
...
spec/models/geo_node_spec.rb
View file @
9c256781
...
@@ -319,13 +319,13 @@ describe GeoNode, type: :model do
...
@@ -319,13 +319,13 @@ describe GeoNode, type: :model do
describe
'#project_ids'
do
describe
'#project_ids'
do
context
'without group restriction'
do
context
'without group restriction'
do
it
'returns
an empty array
'
do
it
'returns
nil
'
do
expect
(
node
.
project_ids
).
to
eq
([])
expect
(
node
.
project_ids
).
to
be_nil
end
end
end
end
context
'with group restrictions'
do
context
'with group restrictions'
do
it
'returns an array with unique project ids'
do
it
'returns an array with unique project ids
that belong to the groups
'
do
group_1
=
create
(
:group
)
group_1
=
create
(
:group
)
group_2
=
create
(
:group
)
group_2
=
create
(
:group
)
nested_group_1
=
create
(
:group
,
parent:
group_1
)
nested_group_1
=
create
(
:group
,
parent:
group_1
)
...
...
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