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
iv
gitlab-ce
Commits
c4dc0f52
Commit
c4dc0f52
authored
Jul 11, 2016
by
tiagonbotelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds test to check json fields on simple request and changes the url request format
parent
f0c437ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
4 deletions
+13
-4
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+1
-1
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+0
-1
lib/api/projects.rb
lib/api/projects.rb
+1
-1
spec/javascripts/project_title_spec.js.coffee
spec/javascripts/project_title_spec.js.coffee
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+10
-0
No files found.
app/assets/javascripts/api.js.coffee
View file @
c4dc0f52
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
groupPath
:
"/api/:version/groups/:id.json"
groupPath
:
"/api/:version/groups/:id.json"
namespacesPath
:
"/api/:version/namespaces.json"
namespacesPath
:
"/api/:version/namespaces.json"
groupProjectsPath
:
"/api/:version/groups/:id/projects.json"
groupProjectsPath
:
"/api/:version/groups/:id/projects.json"
projectsPath
:
"/api/:version/projects.json?
format=simpl
e"
projectsPath
:
"/api/:version/projects.json?
simple=tru
e"
labelsPath
:
"/api/:version/projects/:id/labels"
labelsPath
:
"/api/:version/projects/:id/labels"
licensePath
:
"/api/:version/licenses/:key"
licensePath
:
"/api/:version/licenses/:key"
gitignorePath
:
"/api/:version/gitignores/:key"
gitignorePath
:
"/api/:version/gitignores/:key"
...
...
app/assets/javascripts/gl_dropdown.js.coffee
View file @
c4dc0f52
...
@@ -401,7 +401,6 @@ class GitLabDropdown
...
@@ -401,7 +401,6 @@ class GitLabDropdown
selected
=
true
selected
=
true
# Set URL
# Set URL
console
.
log
(
data
)
if
@
options
.
url
?
if
@
options
.
url
?
url
=
@
options
.
url
(
data
)
url
=
@
options
.
url
(
data
)
else
else
...
...
lib/api/projects.rb
View file @
c4dc0f52
...
@@ -25,7 +25,7 @@ module API
...
@@ -25,7 +25,7 @@ module API
@projects
=
current_user
.
authorized_projects
@projects
=
current_user
.
authorized_projects
@projects
=
filter_projects
(
@projects
)
@projects
=
filter_projects
(
@projects
)
@projects
=
paginate
@projects
@projects
=
paginate
@projects
if
params
[
"
format
"
]
if
params
[
"
simple
"
]
present
@projects
,
with:
Entities
::
BasicProjectWithAccess
,
user:
current_user
present
@projects
,
with:
Entities
::
BasicProjectWithAccess
,
user:
current_user
else
else
present
@projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
present
@projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
...
...
spec/javascripts/project_title_spec.js.coffee
View file @
c4dc0f52
...
@@ -22,7 +22,7 @@ describe 'Project Title', ->
...
@@ -22,7 +22,7 @@ describe 'Project Title', ->
@
projects_data
=
fixture
.
load
(
'projects.json'
)[
0
]
@
projects_data
=
fixture
.
load
(
'projects.json'
)[
0
]
spyOn
(
jQuery
,
'ajax'
).
and
.
callFake
(
req
)
=>
spyOn
(
jQuery
,
'ajax'
).
and
.
callFake
(
req
)
=>
expect
(
req
.
url
).
toBe
(
'/api/v3/projects.json?
format=simpl
e'
)
expect
(
req
.
url
).
toBe
(
'/api/v3/projects.json?
simple=tru
e'
)
d
=
$
.
Deferred
()
d
=
$
.
Deferred
()
d
.
resolve
@
projects_data
d
.
resolve
@
projects_data
d
.
promise
()
d
.
promise
()
...
...
spec/requests/api/projects_spec.rb
View file @
c4dc0f52
...
@@ -81,6 +81,16 @@ describe API::API, api: true do
...
@@ -81,6 +81,16 @@ describe API::API, api: true do
expect
(
json_response
.
first
.
keys
).
not_to
include
(
'open_issues_count'
)
expect
(
json_response
.
first
.
keys
).
not_to
include
(
'open_issues_count'
)
end
end
context
'GET /projects?simple=true'
do
let
(
:keys
)
{
[
"id"
,
"http_url_to_repo"
,
"web_url"
,
"name"
,
"name_with_namespace"
,
"path"
,
"path_with_namespace"
,
"permissions"
]
}
it
'should return a simplified version of all the projects'
do
get
api
(
'/projects?simple=true'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
.
keys
).
to
match_array
keys
end
end
context
'and using search'
do
context
'and using search'
do
it
'should return searched project'
do
it
'should return searched project'
do
get
api
(
'/projects'
,
user
),
{
search:
project
.
name
}
get
api
(
'/projects'
,
user
),
{
search:
project
.
name
}
...
...
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