Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
218c4d09
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,发现更多精彩内容 >>
提交
218c4d09
编写于
5月 16, 2017
作者:
R
Rémy Coutable
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'spec-joining-it' into 'master'
[Spec optimization] Joining one-line 'it' blocks See merge request !11372
上级
1a24a670
268b1c79
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
30 deletion
+46
-30
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+8
-6
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+9
-5
spec/services/merge_requests/create_service_spec.rb
spec/services/merge_requests/create_service_spec.rb
+6
-4
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+23
-15
未找到文件。
spec/services/ci/create_pipeline_service_spec.rb
浏览文件 @
218c4d09
...
@@ -27,12 +27,14 @@ describe Ci::CreatePipelineService, services: true do
...
@@ -27,12 +27,14 @@ describe Ci::CreatePipelineService, services: true do
)
)
end
end
it
{
expect
(
pipeline
).
to
be_kind_of
(
Ci
::
Pipeline
)
}
it
'creates a pipeline'
do
it
{
expect
(
pipeline
).
to
be_valid
}
expect
(
pipeline
).
to
be_kind_of
(
Ci
::
Pipeline
)
it
{
expect
(
pipeline
).
to
eq
(
project
.
pipelines
.
last
)
}
expect
(
pipeline
).
to
be_valid
it
{
expect
(
pipeline
).
to
have_attributes
(
user:
user
)
}
expect
(
pipeline
).
to
eq
(
project
.
pipelines
.
last
)
it
{
expect
(
pipeline
).
to
have_attributes
(
status:
'pending'
)
}
expect
(
pipeline
).
to
have_attributes
(
user:
user
)
it
{
expect
(
pipeline
.
builds
.
first
).
to
be_kind_of
(
Ci
::
Build
)
}
expect
(
pipeline
).
to
have_attributes
(
status:
'pending'
)
expect
(
pipeline
.
builds
.
first
).
to
be_kind_of
(
Ci
::
Build
)
end
context
'#update_merge_requests_head_pipeline'
do
context
'#update_merge_requests_head_pipeline'
do
it
'updates head pipeline of each merge request'
do
it
'updates head pipeline of each merge request'
do
...
...
spec/services/issues/close_service_spec.rb
浏览文件 @
218c4d09
...
@@ -51,8 +51,10 @@ describe Issues::CloseService, services: true do
...
@@ -51,8 +51,10 @@ describe Issues::CloseService, services: true do
end
end
end
end
it
{
expect
(
issue
).
to
be_valid
}
it
'closes the issue'
do
it
{
expect
(
issue
).
to
be_closed
}
expect
(
issue
).
to
be_valid
expect
(
issue
).
to
be_closed
end
it
'sends email to user2 about assign of new issue'
do
it
'sends email to user2 about assign of new issue'
do
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
...
@@ -96,9 +98,11 @@ describe Issues::CloseService, services: true do
...
@@ -96,9 +98,11 @@ describe Issues::CloseService, services: true do
described_class
.
new
(
project
,
user
).
close_issue
(
issue
)
described_class
.
new
(
project
,
user
).
close_issue
(
issue
)
end
end
it
{
expect
(
issue
).
to
be_valid
}
it
'closes the issue'
do
it
{
expect
(
issue
).
to
be_opened
}
expect
(
issue
).
to
be_valid
it
{
expect
(
todo
.
reload
).
to
be_pending
}
expect
(
issue
).
to
be_opened
expect
(
todo
.
reload
).
to
be_pending
end
end
end
end
end
end
end
spec/services/merge_requests/create_service_spec.rb
浏览文件 @
218c4d09
...
@@ -27,10 +27,12 @@ describe MergeRequests::CreateService, services: true do
...
@@ -27,10 +27,12 @@ describe MergeRequests::CreateService, services: true do
@merge_request
=
service
.
execute
@merge_request
=
service
.
execute
end
end
it
{
expect
(
@merge_request
).
to
be_valid
}
it
'creates an MR'
do
it
{
expect
(
@merge_request
.
title
).
to
eq
(
'Awesome merge_request'
)
}
expect
(
@merge_request
).
to
be_valid
it
{
expect
(
@merge_request
.
assignee
).
to
be_nil
}
expect
(
@merge_request
.
title
).
to
eq
(
'Awesome merge_request'
)
it
{
expect
(
@merge_request
.
merge_params
[
'force_remove_source_branch'
]).
to
eq
(
'1'
)
}
expect
(
@merge_request
.
assignee
).
to
be_nil
expect
(
@merge_request
.
merge_params
[
'force_remove_source_branch'
]).
to
eq
(
'1'
)
end
it
'executes hooks with default action'
do
it
'executes hooks with default action'
do
expect
(
service
).
to
have_received
(
:execute_hooks
).
with
(
@merge_request
)
expect
(
service
).
to
have_received
(
:execute_hooks
).
with
(
@merge_request
)
...
...
spec/services/merge_requests/update_service_spec.rb
浏览文件 @
218c4d09
...
@@ -59,14 +59,16 @@ describe MergeRequests::UpdateService, services: true do
...
@@ -59,14 +59,16 @@ describe MergeRequests::UpdateService, services: true do
end
end
end
end
it
{
expect
(
@merge_request
).
to
be_valid
}
it
'mathces base expectations'
do
it
{
expect
(
@merge_request
.
title
).
to
eq
(
'New title'
)
}
expect
(
@merge_request
).
to
be_valid
it
{
expect
(
@merge_request
.
assignee
).
to
eq
(
user2
)
}
expect
(
@merge_request
.
title
).
to
eq
(
'New title'
)
it
{
expect
(
@merge_request
).
to
be_closed
}
expect
(
@merge_request
.
assignee
).
to
eq
(
user2
)
it
{
expect
(
@merge_request
.
labels
.
count
).
to
eq
(
1
)
}
expect
(
@merge_request
).
to
be_closed
it
{
expect
(
@merge_request
.
labels
.
first
.
title
).
to
eq
(
label
.
name
)
}
expect
(
@merge_request
.
labels
.
count
).
to
eq
(
1
)
it
{
expect
(
@merge_request
.
target_branch
).
to
eq
(
'target'
)
}
expect
(
@merge_request
.
labels
.
first
.
title
).
to
eq
(
label
.
name
)
it
{
expect
(
@merge_request
.
merge_params
[
'force_remove_source_branch'
]).
to
eq
(
'1'
)
}
expect
(
@merge_request
.
target_branch
).
to
eq
(
'target'
)
expect
(
@merge_request
.
merge_params
[
'force_remove_source_branch'
]).
to
eq
(
'1'
)
end
it
'executes hooks with update action'
do
it
'executes hooks with update action'
do
expect
(
service
).
to
have_received
(
:execute_hooks
).
expect
(
service
).
to
have_received
(
:execute_hooks
).
...
@@ -148,9 +150,11 @@ describe MergeRequests::UpdateService, services: true do
...
@@ -148,9 +150,11 @@ describe MergeRequests::UpdateService, services: true do
end
end
end
end
it
{
expect
(
@merge_request
).
to
be_valid
}
it
'merges the MR'
do
it
{
expect
(
@merge_request
.
state
).
to
eq
(
'merged'
)
}
expect
(
@merge_request
).
to
be_valid
it
{
expect
(
@merge_request
.
merge_error
).
to
be_nil
}
expect
(
@merge_request
.
state
).
to
eq
(
'merged'
)
expect
(
@merge_request
.
merge_error
).
to
be_nil
end
end
end
context
'with finished pipeline'
do
context
'with finished pipeline'
do
...
@@ -167,8 +171,10 @@ describe MergeRequests::UpdateService, services: true do
...
@@ -167,8 +171,10 @@ describe MergeRequests::UpdateService, services: true do
end
end
end
end
it
{
expect
(
@merge_request
).
to
be_valid
}
it
'merges the MR'
do
it
{
expect
(
@merge_request
.
state
).
to
eq
(
'merged'
)
}
expect
(
@merge_request
).
to
be_valid
expect
(
@merge_request
.
state
).
to
eq
(
'merged'
)
end
end
end
context
'with active pipeline'
do
context
'with active pipeline'
do
...
@@ -202,8 +208,10 @@ describe MergeRequests::UpdateService, services: true do
...
@@ -202,8 +208,10 @@ describe MergeRequests::UpdateService, services: true do
end
end
end
end
it
{
expect
(
@merge_request
.
state
).
to
eq
(
'opened'
)
}
it
'does not merge the MR'
do
it
{
expect
(
@merge_request
.
merge_error
).
not_to
be_nil
}
expect
(
@merge_request
.
state
).
to
eq
(
'opened'
)
expect
(
@merge_request
.
merge_error
).
not_to
be_nil
end
end
end
context
'MR can not be merged when note sha != MR sha'
do
context
'MR can not be merged when note sha != MR sha'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录