Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
42422dcc
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
42422dcc
编写于
2月 07, 2015
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add internal broadcast message API.
上级
d3c2253c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
12 deletion
+45
-12
lib/api/entities.rb
lib/api/entities.rb
+4
-0
lib/api/internal.rb
lib/api/internal.rb
+8
-0
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+33
-12
未找到文件。
lib/api/entities.rb
浏览文件 @
42422dcc
...
...
@@ -270,5 +270,9 @@ module API
class
Contributor
<
Grape
::
Entity
expose
:name
,
:email
,
:commits
,
:additions
,
:deletions
end
class
BroadcastMessage
<
Grape
::
Entity
expose
:message
,
:starts_at
,
:ends_at
,
:color
,
:font
end
end
end
lib/api/internal.rb
浏览文件 @
42422dcc
...
...
@@ -69,6 +69,14 @@ module API
gitlab_rev:
Gitlab
::
REVISION
,
}
end
get
"/broadcast_message"
do
if
message
=
BroadcastMessage
.
current
present
message
,
with:
Entities
::
BroadcastMessage
else
not_found!
end
end
end
end
end
spec/requests/api/internal_spec.rb
浏览文件 @
42422dcc
...
...
@@ -16,6 +16,27 @@ describe API::API, api: true do
end
end
describe
"GET /internal/broadcast_message"
do
context
"broadcast message exists"
do
let!
(
:broadcast_message
)
{
create
(
:broadcast_message
,
starts_at:
Time
.
now
.
yesterday
,
ends_at:
Time
.
now
.
tomorrow
)
}
it
do
get
api
(
"/internal/broadcast_message"
),
secret_token:
secret_token
response
.
status
.
should
==
200
json_response
[
"message"
].
should
==
broadcast_message
.
message
end
end
context
"broadcast message doesn't exist"
do
it
do
get
api
(
"/internal/broadcast_message"
),
secret_token:
secret_token
response
.
status
.
should
==
404
end
end
end
describe
"GET /internal/discover"
do
it
do
get
(
api
(
"/internal/discover"
),
key_id:
key
.
id
,
secret_token:
secret_token
)
...
...
@@ -37,7 +58,7 @@ describe API::API, api: true do
pull
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_true
json_response
[
"status"
].
should
be_true
end
end
...
...
@@ -46,7 +67,7 @@ describe API::API, api: true do
push
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_true
json_response
[
"status"
].
should
be_true
end
end
end
...
...
@@ -61,7 +82,7 @@ describe API::API, api: true do
pull
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
...
...
@@ -70,7 +91,7 @@ describe API::API, api: true do
push
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
end
...
...
@@ -87,7 +108,7 @@ describe API::API, api: true do
pull
(
key
,
personal_project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
...
...
@@ -96,7 +117,7 @@ describe API::API, api: true do
push
(
key
,
personal_project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
end
...
...
@@ -114,7 +135,7 @@ describe API::API, api: true do
pull
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_true
json_response
[
"status"
].
should
be_true
end
end
...
...
@@ -123,7 +144,7 @@ describe API::API, api: true do
push
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
end
...
...
@@ -140,7 +161,7 @@ describe API::API, api: true do
archive
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_true
json_response
[
"status"
].
should
be_true
end
end
...
...
@@ -149,7 +170,7 @@ describe API::API, api: true do
archive
(
key
,
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
end
...
...
@@ -159,7 +180,7 @@ describe API::API, api: true do
pull
(
key
,
OpenStruct
.
new
(
path_with_namespace:
'gitlab/notexists'
))
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
...
...
@@ -168,7 +189,7 @@ describe API::API, api: true do
pull
(
OpenStruct
.
new
(
id:
0
),
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)
[
"status"
].
should
be_false
json_response
[
"status"
].
should
be_false
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录