Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7da750cc
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,发现更多精彩内容 >>
提交
7da750cc
编写于
11月 25, 2015
作者:
M
Marin Jankovski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Specs for links in email notifications for Gmail Actions.
上级
ef2bc0f0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
93 addition
and
1 deletion
+93
-1
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+93
-1
未找到文件。
spec/mailers/notify_spec.rb
浏览文件 @
7da750cc
...
...
@@ -77,6 +77,14 @@ describe Notify do
end
end
shared_examples
'it should have Gmail Actions links'
do
it
{
is_expected
.
to
have_body_text
/ViewAction/
}
end
shared_examples
'it should not have Gmail Actions links'
do
it
{
is_expected
.
to_not
have_body_text
/ViewAction/
}
end
describe
'for new users, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
...
...
@@ -87,6 +95,7 @@ describe Notify do
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
,
new_user_address
it_behaves_like
'it should not have Gmail Actions links'
it
'contains the password text'
do
is_expected
.
to
have_body_text
/Click here to set your password/
...
...
@@ -115,6 +124,7 @@ describe Notify do
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
,
new_user_address
it_behaves_like
'it should not have Gmail Actions links'
it
'should not contain the new user\'s password'
do
is_expected
.
not_to
have_body_text
/password/
...
...
@@ -127,6 +137,7 @@ describe Notify do
subject
{
Notify
.
new_ssh_key_email
(
key
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
key
.
user
.
email
...
...
@@ -150,6 +161,8 @@ describe Notify do
subject
{
Notify
.
new_email_email
(
email
.
id
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
email
.
user
.
email
end
...
...
@@ -194,6 +207,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
project
.
name
}
\|
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -202,6 +216,10 @@ describe Notify do
it
'contains a link to the new issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
describe
'that are new with a description'
do
...
...
@@ -217,6 +235,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -239,6 +258,10 @@ describe Notify do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
describe
'status changed'
do
...
...
@@ -246,6 +269,7 @@ describe Notify do
subject
{
Notify
.
issue_status_changed_email
(
recipient
.
id
,
issue
.
id
,
status
,
current_user
)
}
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -268,8 +292,11 @@ describe Notify do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
end
context
'for merge requests'
do
...
...
@@ -282,6 +309,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -302,14 +330,24 @@ describe Notify do
it
'has the correct message-id set'
do
is_expected
.
to
have_header
'Message-ID'
,
"<merge_request_
#{
merge_request
.
id
}
@
#{
Gitlab
.
config
.
gitlab
.
host
}
>"
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'that are new with a description'
do
subject
{
Notify
.
new_merge_request_email
(
merge_request_with_description
.
assignee_id
,
merge_request_with_description
.
id
)
}
it_behaves_like
'it should have Gmail Actions links'
it
'contains the description'
do
is_expected
.
to
have_body_text
/
#{
merge_request_with_description
.
description
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'that are reassigned'
do
...
...
@@ -317,6 +355,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -339,6 +378,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'status changed'
do
...
...
@@ -346,6 +389,8 @@ describe Notify do
subject
{
Notify
.
merge_request_status_email
(
recipient
.
id
,
merge_request
.
id
,
status
,
current_user
)
}
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -368,6 +413,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'that are merged'
do
...
...
@@ -375,6 +424,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the merge author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -393,6 +443,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
end
...
...
@@ -403,6 +457,7 @@ describe Notify do
subject
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Project was moved/
...
...
@@ -424,13 +479,16 @@ describe Notify do
subject
{
Notify
.
project_access_granted_email
(
project_member
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Access to project was granted/
end
it
'contains name of project'
do
is_expected
.
to
have_body_text
/
#{
project
.
name
}
/
end
it
'contains new user role'
do
is_expected
.
to
have_body_text
/
#{
project_member
.
human_access
}
/
end
...
...
@@ -445,6 +503,8 @@ describe Notify do
end
shared_examples
'a note email'
do
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
note_author
.
name
)
...
...
@@ -469,6 +529,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'commit'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
commit
.
title
}
\(
#{
commit
.
short_id
}
\)/
...
...
@@ -477,6 +538,10 @@ describe Notify do
it
'contains a link to the commit'
do
is_expected
.
to
have_body_text
commit
.
short_id
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
end
end
describe
'on a merge request'
do
...
...
@@ -488,6 +553,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -496,6 +562,10 @@ describe Notify do
it
'contains a link to the merge request note'
do
is_expected
.
to
have_body_text
/
#{
note_on_merge_request_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'on an issue'
do
...
...
@@ -507,6 +577,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -515,6 +586,10 @@ describe Notify do
it
'contains a link to the issue note'
do
is_expected
.
to
have_body_text
/
#{
note_on_issue_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
end
end
...
...
@@ -527,6 +602,7 @@ describe Notify do
subject
{
Notify
.
group_access_granted_email
(
membership
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Access to group was granted/
...
...
@@ -574,6 +650,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :create
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -600,6 +678,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/tags/v1.0'
,
action: :create
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -625,6 +705,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :delete
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -646,6 +728,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/tags/v1.0'
,
action: :delete
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -671,6 +755,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :push
,
compare:
compare
,
reverse_compare:
false
,
send_from_committer_email:
send_from_committer_email
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -774,6 +860,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :push
,
compare:
compare
)
}
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -799,5 +887,9 @@ describe Notify do
it
'contains a link to the diff'
do
is_expected
.
to
have_body_text
/
#{
diff_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录