Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7d8d9bd1
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,发现更多精彩内容 >>
未验证
提交
7d8d9bd1
编写于
4月 02, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove issue observer tests
Signed-off-by:
N
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
上级
ed67ba96
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
99 deletion
+0
-99
spec/observers/issue_observer_spec.rb
spec/observers/issue_observer_spec.rb
+0
-99
未找到文件。
spec/observers/issue_observer_spec.rb
已删除
100644 → 0
浏览文件 @
ed67ba96
require
'spec_helper'
describe
IssueObserver
do
let
(
:some_user
)
{
create
:user
}
let
(
:assignee
)
{
create
:user
}
let
(
:author
)
{
create
:user
}
let
(
:mock_issue
)
{
create
(
:issue
,
assignee:
assignee
,
author:
author
)
}
before
{
subject
.
stub
(
:current_user
).
and_return
(
some_user
)
}
before
{
subject
.
stub
(
:current_commit
).
and_return
(
nil
)
}
before
{
subject
.
stub
(
notification:
double
(
'NotificationService'
).
as_null_object
)
}
before
{
mock_issue
.
project
.
stub_chain
(
:repository
,
:commit
).
and_return
(
nil
)
}
subject
{
IssueObserver
.
instance
}
describe
'#after_create'
do
it
'trigger notification to send emails'
do
subject
.
should_receive
(
:notification
)
subject
.
after_create
(
mock_issue
)
end
it
'should create cross-reference notes'
do
other_issue
=
create
(
:issue
)
mock_issue
.
stub
(
references:
[
other_issue
])
Note
.
should_receive
(
:create_cross_reference_note
).
with
(
other_issue
,
mock_issue
,
some_user
,
mock_issue
.
project
)
subject
.
after_create
(
mock_issue
)
end
end
context
'#after_close'
do
context
'a status "closed"'
do
before
{
mock_issue
.
stub
(
state:
'closed'
)
}
it
'note is created if the issue is being closed'
do
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'closed'
,
nil
)
subject
.
after_close
(
mock_issue
,
nil
)
end
it
'trigger notification to send emails'
do
subject
.
notification
.
should_receive
(
:close_issue
).
with
(
mock_issue
,
some_user
)
subject
.
after_close
(
mock_issue
,
nil
)
end
it
'appends a mention to the closing commit if one is present'
do
commit
=
double
(
'commit'
,
gfm_reference:
'commit 123456'
)
subject
.
stub
(
current_commit:
commit
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'closed'
,
commit
)
subject
.
after_close
(
mock_issue
,
nil
)
end
end
context
'a status "reopened"'
do
before
{
mock_issue
.
stub
(
state:
'reopened'
)
}
it
'note is created if the issue is being reopened'
do
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'reopened'
,
nil
)
subject
.
after_reopen
(
mock_issue
,
nil
)
end
end
end
context
'#after_update'
do
before
(
:each
)
do
mock_issue
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
end
context
'notification'
do
it
'triggered if the issue is being reassigned'
do
mock_issue
.
should_receive
(
:is_being_reassigned?
).
and_return
(
true
)
subject
.
should_receive
(
:notification
)
subject
.
after_update
(
mock_issue
)
end
it
'is not triggered if the issue is not being reassigned'
do
mock_issue
.
should_receive
(
:is_being_reassigned?
).
and_return
(
false
)
subject
.
should_not_receive
(
:notification
)
subject
.
after_update
(
mock_issue
)
end
end
context
'cross-references'
do
it
'notices added references'
do
mock_issue
.
should_receive
(
:notice_added_references
)
subject
.
after_update
(
mock_issue
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录