Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e533d43a
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,发现更多精彩内容 >>
提交
e533d43a
编写于
4月 06, 2017
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix specs related to new manual actions permissions
上级
f647ad8f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
14 deletion
+54
-14
spec/factories/environments.rb
spec/factories/environments.rb
+3
-1
spec/features/projects/environments/environment_spec.rb
spec/features/projects/environments/environment_spec.rb
+4
-0
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+40
-13
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+7
-0
未找到文件。
spec/factories/environments.rb
浏览文件 @
e533d43a
...
...
@@ -18,6 +18,8 @@ FactoryGirl.define do
# interconnected objects to simulate a review app.
#
after
(
:create
)
do
|
environment
,
evaluator
|
pipeline
=
create
(
:ci_pipeline
,
project:
environment
.
project
)
deployment
=
create
(
:deployment
,
environment:
environment
,
project:
environment
.
project
,
...
...
@@ -26,7 +28,7 @@ FactoryGirl.define do
teardown_build
=
create
(
:ci_build
,
:manual
,
name:
"
#{
deployment
.
environment
.
name
}
:teardown"
,
pipeline:
deployment
.
deployable
.
pipeline
)
pipeline:
pipeline
)
deployment
.
update_column
(
:on_stop
,
teardown_build
.
name
)
environment
.
update_attribute
(
:deployments
,
[
deployment
])
...
...
spec/features/projects/environments/environment_spec.rb
浏览文件 @
e533d43a
...
...
@@ -62,6 +62,8 @@ feature 'Environment', :feature do
name:
'deploy to production'
)
end
given
(
:role
)
{
:master
}
scenario
'does show a play button'
do
expect
(
page
).
to
have_link
(
action
.
name
.
humanize
)
end
...
...
@@ -132,6 +134,8 @@ feature 'Environment', :feature do
on_stop:
'close_app'
)
end
given
(
:role
)
{
:master
}
scenario
'does allow to stop environment'
do
click_link
(
'Stop'
)
...
...
spec/models/environment_spec.rb
浏览文件 @
e533d43a
...
...
@@ -191,25 +191,52 @@ describe Environment, models: true do
end
context
'when matching action is defined'
do
let
(
:build
)
{
create
(
:ci_build
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
,
on_stop:
'close_app'
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:deployment
)
do
create
(
:deployment
,
environment:
environment
,
deployable:
build
,
on_stop:
'close_app'
)
end
context
'when action did not yet finish'
do
let!
(
:close_action
)
{
create
(
:ci_build
,
:manual
,
pipeline:
build
.
pipeline
,
name:
'close_app'
)
}
context
'when user is not allowed to stop environment'
do
let!
(
:close_action
)
do
create
(
:ci_build
,
:manual
,
pipeline:
pipeline
,
name:
'close_app'
)
end
it
'returns the same action'
do
expect
(
subject
).
to
eq
(
close_action
)
expect
(
subject
.
user
).
to
eq
(
user
)
it
'raises an exception'
do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
Access
::
AccessDeniedError
)
end
end
context
'if action did finish'
do
let!
(
:close_action
)
{
create
(
:ci_build
,
:manual
,
:success
,
pipeline:
build
.
pipeline
,
name:
'close_app'
)
}
context
'when user is allowed to stop environment'
do
before
do
project
.
add_master
(
user
)
end
context
'when action did not yet finish'
do
let!
(
:close_action
)
do
create
(
:ci_build
,
:manual
,
pipeline:
pipeline
,
name:
'close_app'
)
end
it
'returns the same action'
do
expect
(
subject
).
to
eq
(
close_action
)
expect
(
subject
.
user
).
to
eq
(
user
)
end
end
it
'returns a new action of the same type'
do
is_expected
.
to
be_persisted
expect
(
subject
.
name
).
to
eq
(
close_action
.
name
)
expect
(
subject
.
user
).
to
eq
(
user
)
context
'if action did finish'
do
let!
(
:close_action
)
do
create
(
:ci_build
,
:manual
,
:success
,
pipeline:
pipeline
,
name:
'close_app'
)
end
it
'returns a new action of the same type'
do
expect
(
subject
).
to
be_persisted
expect
(
subject
.
name
).
to
eq
(
close_action
.
name
)
expect
(
subject
.
user
).
to
eq
(
user
)
end
end
end
end
...
...
spec/services/ci/process_pipeline_service_spec.rb
浏览文件 @
e533d43a
...
...
@@ -314,6 +314,13 @@ describe Ci::ProcessPipelineService, '#execute', :services do
end
context
'when pipeline is promoted sequentially up to the end'
do
before
do
# We are using create(:empty_project), and users has to be master in
# order to execute manual action when repository does not exist.
#
project
.
add_master
(
user
)
end
it
'properly processes entire pipeline'
do
process_pipeline
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录