Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
05c4ad9d
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05c4ad9d
编写于
1月 26, 2010
作者:
J
José Valim and Mikel Lindsaar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tidy up tests and docs.
上级
ccea6ab0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
20 deletion
+21
-20
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+2
-2
actionmailer/test/base_test.rb
actionmailer/test/base_test.rb
+19
-18
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
05c4ad9d
...
...
@@ -360,8 +360,8 @@ def initialize(method_name=nil, *args)
# You can also pass a hash into headers of header field names and values, which
# will then be set on the Mail::Message object:
#
# headers
{
'X-Special-Domain-Specific-Header' => "SecretValue",
#
'In-Reply-To' => incoming.message_id }
# headers 'X-Special-Domain-Specific-Header' => "SecretValue",
#
'In-Reply-To' => incoming.message_id
#
# The resulting Mail::Message will have the following in it's header:
#
...
...
actionmailer/test/base_test.rb
浏览文件 @
05c4ad9d
...
...
@@ -79,7 +79,7 @@ def custom_block(include_html=false)
# Basic mail usage without block
test
"mail() should set the headers of the mail message"
do
email
=
BaseMailer
.
welcome
assert_equal
([
'system@test.lindsaar.net'
],
email
.
to
)
assert_equal
([
'system@test.lindsaar.net'
],
email
.
to
)
assert_equal
([
'jose@test.plataformatec.com'
],
email
.
from
)
assert_equal
(
'The first email on new API!'
,
email
.
subject
)
end
...
...
@@ -126,6 +126,22 @@ def custom_block(include_html=false)
assert_equal
(
"Not SPAM"
,
email
[
'X-SPAM'
].
decoded
)
end
test
"can pass random headers in as a hash to mail"
do
hash
=
{
'X-Special-Domain-Specific-Header'
=>
"SecretValue"
,
'In-Reply-To'
=>
'1234@mikel.me.com'
}
mail
=
BaseMailer
.
simple
(
hash
)
assert_equal
(
'SecretValue'
,
mail
[
'X-Special-Domain-Specific-Header'
].
decoded
)
assert_equal
(
'1234@mikel.me.com'
,
mail
[
'In-Reply-To'
].
decoded
)
end
test
"can pass random headers in as a hash"
do
hash
=
{
'X-Special-Domain-Specific-Header'
=>
"SecretValue"
,
'In-Reply-To'
=>
'1234@mikel.me.com'
}
mail
=
BaseMailer
.
simple_with_headers
(
hash
)
assert_equal
(
'SecretValue'
,
mail
[
'X-Special-Domain-Specific-Header'
].
decoded
)
assert_equal
(
'1234@mikel.me.com'
,
mail
[
'In-Reply-To'
].
decoded
)
end
# Attachments
test
"attachment with content"
do
email
=
BaseMailer
.
attachment_with_content
...
...
@@ -397,7 +413,8 @@ def custom_block(include_html=false)
test
"calling deliver on the action should deliver the mail object"
do
BaseMailer
.
deliveries
.
clear
BaseMailer
.
expects
(
:deliver_mail
).
once
BaseMailer
.
welcome
.
deliver
mail
=
BaseMailer
.
welcome
.
deliver
assert_instance_of
Mail
::
Message
,
mail
end
test
"calling deliver on the action should increment the deliveries collection"
do
...
...
@@ -417,22 +434,6 @@ def custom_block(include_html=false)
mail
=
BaseMailer
.
explicit_multipart
assert_not_nil
(
mail
.
content_type_parameters
[
:boundary
])
end
test
"can pass random headers in as a hash"
do
hash
=
{
'X-Special-Domain-Specific-Header'
=>
"SecretValue"
,
'In-Reply-To'
=>
'1234@mikel.me.com'
}
mail
=
BaseMailer
.
simple_with_headers
(
hash
)
assert_equal
(
'SecretValue'
,
mail
[
'X-Special-Domain-Specific-Header'
].
decoded
)
assert_equal
(
'1234@mikel.me.com'
,
mail
[
'In-Reply-To'
].
decoded
)
end
test
"can pass random headers in as a hash to mail"
do
hash
=
{
'X-Special-Domain-Specific-Header'
=>
"SecretValue"
,
'In-Reply-To'
=>
'1234@mikel.me.com'
}
mail
=
BaseMailer
.
simple
(
hash
)
assert_equal
(
'SecretValue'
,
mail
[
'X-Special-Domain-Specific-Header'
].
decoded
)
assert_equal
(
'1234@mikel.me.com'
,
mail
[
'In-Reply-To'
].
decoded
)
end
protected
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录