Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2cc8f43e
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,发现更多精彩内容 >>
提交
2cc8f43e
编写于
5月 05, 2017
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Introduce generic manual action extended status class
上级
53219857
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
57 addition
and
43 deletion
+57
-43
lib/gitlab/ci/status/build/action.rb
lib/gitlab/ci/status/build/action.rb
+23
-0
lib/gitlab/ci/status/build/factory.rb
lib/gitlab/ci/status/build/factory.rb
+2
-1
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+1
-5
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+18
-14
spec/lib/gitlab/ci/status/build/play_spec.rb
spec/lib/gitlab/ci/status/build/play_spec.rb
+13
-23
未找到文件。
lib/gitlab/ci/status/build/action.rb
0 → 100644
浏览文件 @
2cc8f43e
module
Gitlab
module
Ci
module
Status
module
Build
class
Action
<
SimpleDelegator
include
Status
::
Extended
def
label
if
has_action?
__getobj__
.
label
else
"
#{
__getobj__
.
label
}
(not allowed)"
end
end
def
self
.
matches?
(
build
,
user
)
build
.
action?
end
end
end
end
end
end
lib/gitlab/ci/status/build/factory.rb
浏览文件 @
2cc8f43e
...
...
@@ -8,7 +8,8 @@ module Gitlab
Status
::
Build
::
Retryable
],
[
Status
::
Build
::
FailedAllowed
,
Status
::
Build
::
Play
,
Status
::
Build
::
Stop
]]
Status
::
Build
::
Stop
],
[
Status
::
Build
::
Action
]]
end
def
self
.
common_helpers
...
...
lib/gitlab/ci/status/build/play.rb
浏览文件 @
2cc8f43e
...
...
@@ -6,11 +6,7 @@ module Gitlab
include
Status
::
Extended
def
label
if
has_action?
'manual play action'
else
'manual play action (not allowed)'
end
'manual play action'
end
def
has_action?
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
浏览文件 @
2cc8f43e
...
...
@@ -204,11 +204,12 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Play
]
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Play
,
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
end
it
'fabricates a
play
detailed status'
do
expect
(
status
).
to
be_a
Gitlab
::
Ci
::
Status
::
Build
::
Play
it
'fabricates a
ction
detailed status'
do
expect
(
status
).
to
be_a
Gitlab
::
Ci
::
Status
::
Build
::
Action
end
it
'fabricates status with correct details'
do
...
...
@@ -247,21 +248,24 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Stop
]
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Stop
,
Gitlab
::
Ci
::
Status
::
Build
::
Action
]
end
it
'fabricates a
stop
detailed status'
do
expect
(
status
).
to
be_a
Gitlab
::
Ci
::
Status
::
Build
::
Stop
it
'fabricates a
ction
detailed status'
do
expect
(
status
).
to
be_a
Gitlab
::
Ci
::
Status
::
Build
::
Action
end
it
'fabricates status with correct details'
do
expect
(
status
.
text
).
to
eq
'manual'
expect
(
status
.
group
).
to
eq
'manual'
expect
(
status
.
icon
).
to
eq
'icon_status_manual'
expect
(
status
.
favicon
).
to
eq
'favicon_status_manual'
expect
(
status
.
label
).
to
eq
'manual stop action'
expect
(
status
).
to
have_details
expect
(
status
).
to
have_action
context
'when user is not allowed to execute manual action'
do
it
'fabricates status with correct details'
do
expect
(
status
.
text
).
to
eq
'manual'
expect
(
status
.
group
).
to
eq
'manual'
expect
(
status
.
icon
).
to
eq
'icon_status_manual'
expect
(
status
.
favicon
).
to
eq
'favicon_status_manual'
expect
(
status
.
label
).
to
eq
'manual stop action (not allowed)'
expect
(
status
).
to
have_details
expect
(
status
).
not_to
have_action
end
end
end
end
...
...
spec/lib/gitlab/ci/status/build/play_spec.rb
浏览文件 @
2cc8f43e
...
...
@@ -7,38 +7,28 @@ describe Gitlab::Ci::Status::Build::Play do
subject
{
described_class
.
new
(
status
)
}
context
'when user is allowed to update build'
do
context
'when user can push to branch'
do
before
{
build
.
project
.
add_master
(
user
)
}
describe
'#label'
do
it
'has a label that says it is a manual action'
do
expect
(
subject
.
label
).
to
eq
'manual play action'
end
end
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
context
'when user can push to branch'
do
before
{
build
.
project
.
add_master
(
user
)
}
describe
'#has_action?'
do
it
{
is_expected
.
to
have_action
}
end
describe
'#label'
do
it
'has a label that says it is a manual action'
do
expect
(
subject
.
label
).
to
eq
'manual play action'
end
end
end
context
'when user can not push to the branch'
do
before
{
build
.
project
.
add_developer
(
user
)
}
context
'when user can not push to the branch'
do
before
{
build
.
project
.
add_developer
(
user
)
}
describe
'has_action?'
do
it
{
is_expected
.
not_to
have_action
}
end
describe
'#label'
do
it
'has a label that says user is not allowed to play it'
do
expect
(
subject
.
label
).
to
eq
'manual play action (not allowed)'
end
end
end
end
context
'when user is not allowed to update build'
do
describe
'#has_action?'
do
context
'when user is not allowed to update build'
do
it
{
is_expected
.
not_to
have_action
}
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录