diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-25 16:22:08 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-25 16:22:08 +0300 |
commit | eaeb4a90d431ff5e1e6156c10f3118f70c3c4f8e (patch) | |
tree | 3d70b6de4c1192aafdbb1f4ebd12d7b4b905f8ba | |
parent | 66ef5c1aa2f50b93ad654dc3b8d9f3a0f5c8bc1b (diff) | |
download | gitlab-ce-eaeb4a90d431ff5e1e6156c10f3118f70c3c4f8e.tar.gz |
Fix branch API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | lib/api/branches.rb | 4 | ||||
-rw-r--r-- | spec/models/wiki_page_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/branches_spec.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index 75783628e3d..14f8b20f6b2 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -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 @@ -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 diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index cb42822b9bb..d065431ee3a 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -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 diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index caded2c9289..8834a6cfa83 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -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 |