API delete branch: render branch name json instead of true
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
8388bbe829
commit
961a6bfcc2
3 changed files with 6 additions and 1 deletions
|
@ -19,6 +19,7 @@ class Projects::BranchesController < Projects::ApplicationController
|
|||
def create
|
||||
result = CreateBranchService.new(project, current_user).
|
||||
execute(params[:branch_name], params[:ref])
|
||||
|
||||
if result[:status] == :success
|
||||
@branch = result[:branch]
|
||||
redirect_to project_tree_path(@project, @branch.name)
|
||||
|
|
|
@ -82,6 +82,7 @@ module API
|
|||
authorize_push_project
|
||||
result = CreateBranchService.new(user_project, current_user).
|
||||
execute(params[:branch_name], params[:ref])
|
||||
|
||||
if result[:status] == :success
|
||||
present result[:branch],
|
||||
with: Entities::RepoObject,
|
||||
|
@ -104,7 +105,9 @@ module API
|
|||
execute(params[:branch])
|
||||
|
||||
if result[:status] == :success
|
||||
true
|
||||
{
|
||||
branch_name: params[:branch]
|
||||
}
|
||||
else
|
||||
render_api_error!(result[:message], result[:return_code])
|
||||
end
|
||||
|
|
|
@ -146,6 +146,7 @@ describe API::API, api: true do
|
|||
it "should remove branch" do
|
||||
delete api("/projects/#{project.id}/repository/branches/#{branch_name}", user)
|
||||
response.status.should == 200
|
||||
json_response['branch_name'].should == branch_name
|
||||
end
|
||||
|
||||
it 'should return 404 if branch not exists' do
|
||||
|
|
Loading…
Reference in a new issue