Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c0033e96
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,发现更多精彩内容 >>
提交
c0033e96
编写于
2月 12, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move profile notifications specs to separate file
上级
055ec4dc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
107 addition
and
98 deletion
+107
-98
spec/mailers/emails/profile_spec.rb
spec/mailers/emails/profile_spec.rb
+107
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+0
-98
未找到文件。
spec/mailers/emails/profile_spec.rb
0 → 100644
浏览文件 @
c0033e96
require
'spec_helper'
require
'email_spec'
require
'mailers/shared/notify'
describe
Notify
do
include
EmailSpec
::
Matchers
include_context
'gitlab email notification'
describe
'profile notifications'
do
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
)
}
let
(
:token
)
{
'kETLwRaayvigPq_x3SNM'
}
subject
{
Notify
.
new_user_email
(
new_user
.
id
,
token
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'contains the password text'
do
is_expected
.
to
have_body_text
/Click here to set your password/
end
it
'includes a link for user to set password'
do
params
=
"reset_password_token=
#{
token
}
"
is_expected
.
to
have_body_text
(
%r{http://localhost(:
\d
+)?/users/password/edit
\?
#{
params
}
}
)
end
it
'explains the reset link expiration'
do
is_expected
.
to
have_body_text
(
/This link is valid for \d+ (hours?|days?)/
)
is_expected
.
to
have_body_text
(
new_user_password_url
)
is_expected
.
to
have_body_text
(
/\?user_email=.*%40.*/
)
end
end
describe
'for users that signed up, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
password:
"securePassword"
)
}
subject
{
Notify
.
new_user_email
(
new_user
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'should not contain the new user\'s password'
do
is_expected
.
not_to
have_body_text
/password/
end
end
describe
'user added ssh key'
do
let
(
:key
)
{
create
(
:personal_key
)
}
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_behaves_like
'a user cannot unsubscribe through footer link'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
key
.
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
/^SSH key was added to your account$/i
end
it
'contains the new ssh key title'
do
is_expected
.
to
have_body_text
/
#{
key
.
title
}
/
end
it
'includes a link to ssh keys page'
do
is_expected
.
to
have_body_text
/
#{
profile_keys_path
}
/
end
end
describe
'user added email'
do
let
(
:email
)
{
create
(
:email
)
}
subject
{
Notify
.
new_email_email
(
email
.
id
)
}
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
email
.
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
/^Email was added to your account$/i
end
it
'contains the new email address'
do
is_expected
.
to
have_body_text
/
#{
email
.
email
}
/
end
it
'includes a link to emails page'
do
is_expected
.
to
have_body_text
/
#{
profile_emails_path
}
/
end
end
end
end
spec/mailers/notify_spec.rb
浏览文件 @
c0033e96
...
...
@@ -9,104 +9,6 @@ describe Notify do
include_context
'gitlab email notification'
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
)
}
token
=
'kETLwRaayvigPq_x3SNM'
subject
{
Notify
.
new_user_email
(
new_user
.
id
,
token
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'contains the password text'
do
is_expected
.
to
have_body_text
/Click here to set your password/
end
it
'includes a link for user to set password'
do
params
=
"reset_password_token=
#{
token
}
"
is_expected
.
to
have_body_text
(
%r{http://localhost(:
\d
+)?/users/password/edit
\?
#{
params
}
}
)
end
it
'explains the reset link expiration'
do
is_expected
.
to
have_body_text
(
/This link is valid for \d+ (hours?|days?)/
)
is_expected
.
to
have_body_text
(
new_user_password_url
)
is_expected
.
to
have_body_text
(
/\?user_email=.*%40.*/
)
end
end
describe
'for users that signed up, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
password:
"securePassword"
)
}
subject
{
Notify
.
new_user_email
(
new_user
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'should not contain the new user\'s password'
do
is_expected
.
not_to
have_body_text
/password/
end
end
describe
'user added ssh key'
do
let
(
:key
)
{
create
(
:personal_key
)
}
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_behaves_like
'a user cannot unsubscribe through footer link'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
key
.
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
/^SSH key was added to your account$/i
end
it
'contains the new ssh key title'
do
is_expected
.
to
have_body_text
/
#{
key
.
title
}
/
end
it
'includes a link to ssh keys page'
do
is_expected
.
to
have_body_text
/
#{
profile_keys_path
}
/
end
end
describe
'user added email'
do
let
(
:email
)
{
create
(
:email
)
}
subject
{
Notify
.
new_email_email
(
email
.
id
)
}
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
'a user cannot unsubscribe through footer link'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
email
.
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
/^Email was added to your account$/i
end
it
'contains the new email address'
do
is_expected
.
to
have_body_text
/
#{
email
.
email
}
/
end
it
'includes a link to emails page'
do
is_expected
.
to
have_body_text
/
#{
profile_emails_path
}
/
end
end
context
'for a project'
do
describe
'items that are assignable, the email'
do
let
(
:current_user
)
{
create
(
:user
,
email:
"current@email.com"
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录