Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
lib/api/helpers.rb
lib/api/helpers.rb
+2
-1
spec/api/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