Skip to content
Snippets Groups Projects
Unverified Commit eaeb4a90 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix branch API

parent 66ef5c1a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,7 +14,7 @@ module API
# Example Request:
# GET /projects/:id/repository/branches
get ":id/repository/branches" do
present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject, project: user_project
present user_project.repository.branches.sort_by(&:name), with: Entities::RepoObject, project: user_project
end
 
# Get a single branch
Loading
Loading
@@ -25,7 +25,7 @@ module API
# Example Request:
# GET /projects/:id/repository/branches/:branch
get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do
@branch = user_project.repo.heads.find { |item| item.name == params[:branch] }
@branch = user_project.repository.branches.find { |item| item.name == params[:branch] }
not_found!("Branch does not exist") if @branch.nil?
present @branch, with: Entities::RepoObject, project: user_project
end
Loading
Loading
Loading
Loading
@@ -36,7 +36,7 @@ describe WikiPage do
end
 
it "sets the version attribute" do
@wiki_page.version.should be_a Commit
@wiki_page.version.should be_a Grit::Commit
end
end
end
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@ describe API::API, api: true do
get api("/projects/#{project.id}/repository/branches", user)
response.status.should == 200
json_response.should be_an Array
json_response.first['name'].should == project.repo.heads.sort_by(&:name).first.name
json_response.first['name'].should == project.repository.branch_names.first
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment