Skip to content
Snippets Groups Projects
Commit 1b95c8bf authored by Nihad Abbasov's avatar Nihad Abbasov
Browse files

API: ability to get project by id

parent 92d98f5a
No related branches found
No related tags found
1 merge request!1142API changes
Loading
Loading
@@ -5,7 +5,8 @@ module Gitlab
end
 
def user_project
@project ||= current_user.projects.find_by_code(params[:id])
@project ||= current_user.projects.find_by_id(params[:id]) ||
current_user.projects.find_by_code(params[:id])
end
 
def authenticate!
Loading
Loading
Loading
Loading
@@ -25,11 +25,17 @@ describe Gitlab::API do
 
describe "GET /projects/:id" do
it "should return a project by id" do
get "#{api_prefix}/projects/#{project.code}?private_token=#{user.private_token}"
get "#{api_prefix}/projects/#{project.id}?private_token=#{user.private_token}"
response.status.should == 200
json_response['name'].should == project.name
json_response['owner']['email'].should == user.email
end
it "should return a project by code name" do
get "#{api_prefix}/projects/#{project.code}?private_token=#{user.private_token}"
response.status.should == 200
json_response['name'].should == project.name
end
end
 
describe "GET /projects/:id/repository/branches" do
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