BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
398a70f3
Commit
398a70f3
authored
Mar 16, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include routes when loading user projects
parent
68e64a5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
todos_helper.rb
app/helpers/todos_helper.rb
+1
-2
todos_helper_spec.rb
spec/helpers/todos_helper_spec.rb
+23
-0
No files found.
app/helpers/todos_helper.rb
View file @
398a70f3
...
...
@@ -99,8 +99,7 @@ module TodosHelper
end
def
todo_projects_options
projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
projects
=
projects
.
includes
(
:namespace
)
projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
.
with_route
projects
=
projects
.
map
do
|
project
|
{
id:
project
.
id
,
text:
project
.
name_with_namespace
}
...
...
spec/helpers/todos_helper_spec.rb
0 → 100644
View file @
398a70f3
require
"spec_helper"
describe
TodosHelper
do
describe
'#todo_projects_options'
do
let
(
:projects
)
{
create_list
(
:empty_project
,
3
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'returns users authorised projects in json format'
do
projects
.
first
.
add_developer
(
user
)
projects
.
second
.
add_developer
(
user
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
expected_results
=
[
{
'id'
=>
''
,
'text'
=>
'Any Project'
},
{
'id'
=>
projects
.
second
.
id
,
'text'
=>
projects
.
second
.
name_with_namespace
},
{
'id'
=>
projects
.
first
.
id
,
'text'
=>
projects
.
first
.
name_with_namespace
}
]
expect
(
JSON
.
parse
(
helper
.
todo_projects_options
)).
to
match_array
(
expected_results
)
end
end
end
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