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
905a2993
Commit
905a2993
authored
Mar 05, 2017
by
George Andrinopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix json response in branches controller
parent
a69aa3da
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-1
changelogs/unreleased/28898-fix-search-branches-in-cherry-picking.yml
...nreleased/28898-fix-search-branches-in-cherry-picking.yml
+4
-0
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+23
-0
No files found.
app/controllers/projects/branches_controller.rb
View file @
905a2993
...
...
@@ -20,7 +20,7 @@ class Projects::BranchesController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
@
repository
.
branch_names
render
json:
@
branches
.
map
(
&
:name
)
end
end
end
...
...
changelogs/unreleased/28898-fix-search-branches-in-cherry-picking.yml
0 → 100644
View file @
905a2993
---
title
:
Fix json response in branches controller
merge_request
:
9710
author
:
George Andrinopoulos
spec/controllers/projects/branches_controller_spec.rb
View file @
905a2993
...
...
@@ -244,4 +244,27 @@ describe Projects::BranchesController do
end
end
end
describe
"GET index"
do
render_views
before
do
sign_in
(
user
)
end
context
'when rendering a JSON format'
do
it
'filters branches by name'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
format: :json
,
search:
'master'
parsed_response
=
JSON
.
parse
(
response
.
body
)
expect
(
parsed_response
.
length
).
to
eq
1
expect
(
parsed_response
.
first
).
to
eq
'master'
end
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