BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1b95c8bf
Commit
1b95c8bf
authored
Jul 25, 2012
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: ability to get project by id
parent
92d98f5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
helpers.rb
lib/api/helpers.rb
+2
-1
projects_spec.rb
spec/api/projects_spec.rb
+7
-1
No files found.
lib/api/helpers.rb
View file @
1b95c8bf
...
...
@@ -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!
...
...
spec/api/projects_spec.rb
View file @
1b95c8bf
...
...
@@ -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
...
...
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