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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
ba34045f
Commit
ba34045f
authored
Nov 12, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose release notes to tags api
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c119a737
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
lib/api/entities.rb
lib/api/entities.rb
+6
-0
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+25
-5
No files found.
lib/api/entities.rb
View file @
ba34045f
...
@@ -112,6 +112,12 @@ module API
...
@@ -112,6 +112,12 @@ module API
options
[
:project
].
repository
.
commit
(
repo_obj
.
target
)
options
[
:project
].
repository
.
commit
(
repo_obj
.
target
)
end
end
end
end
expose
:release
do
|
repo_obj
,
options
|
if
options
[
:project
]
options
[
:project
].
releases
.
find_by
(
tag:
repo_obj
.
name
)
end
end
end
end
class
RepoObject
<
Grape
::
Entity
class
RepoObject
<
Grape
::
Entity
...
...
spec/requests/api/tags_spec.rb
View file @
ba34045f
...
@@ -12,11 +12,31 @@ describe API::API, api: true do
...
@@ -12,11 +12,31 @@ describe API::API, api: true do
let!
(
:guest
)
{
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
}
let!
(
:guest
)
{
create
(
:project_member
,
user:
user2
,
project:
project
,
access_level:
ProjectMember
::
GUEST
)
}
describe
"GET /projects/:id/repository/tags"
do
describe
"GET /projects/:id/repository/tags"
do
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
sort
.
reverse
.
first
}
let
(
:description
)
{
'Awesome release!'
}
context
'without releases'
do
it
"should return an array of project tags"
do
it
"should return an array of project tags"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
project
.
repo
.
tags
.
sort_by
(
&
:name
).
reverse
.
first
.
name
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
tag_name
)
end
end
context
'with releases'
do
before
do
release
=
project
.
releases
.
find_or_initialize_by
(
tag:
tag_name
)
release
.
update_attributes
(
description:
description
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user
)
end
it
"should return an array of project tags with release info"
do
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
tag_name
)
expect
(
json_response
.
first
[
'release'
][
'description'
]).
to
eq
(
description
)
end
end
end
end
end
...
...
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