Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3829f9ec
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,发现更多精彩内容 >>
提交
3829f9ec
编写于
1月 21, 2010
作者:
J
José Valim and Mikel Lindsaar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding tests for attachments['blah.rb'] = {} et al
上级
fbdbac2b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
3 deletion
+44
-3
actionmailer/actionmailer.gemspec
actionmailer/actionmailer.gemspec
+1
-1
actionmailer/lib/action_mailer/deprecated_api.rb
actionmailer/lib/action_mailer/deprecated_api.rb
+11
-1
actionmailer/lib/action_mailer/tmail_compat.rb
actionmailer/lib/action_mailer/tmail_compat.rb
+5
-0
actionmailer/test/base_test.rb
actionmailer/test/base_test.rb
+26
-1
actionmailer/test/mail_service_test.rb
actionmailer/test/mail_service_test.rb
+1
-0
未找到文件。
actionmailer/actionmailer.gemspec
浏览文件 @
3829f9ec
...
...
@@ -11,7 +11,7 @@
s
.
homepage
=
"http://www.rubyonrails.org"
s
.
add_dependency
(
'actionpack'
,
'= 3.0.pre'
)
s
.
add_dependency
(
'mail'
,
'~> 2.0.
1
'
)
s
.
add_dependency
(
'mail'
,
'~> 2.0.
2
'
)
s
.
files
=
Dir
[
'CHANGELOG'
,
'README'
,
'MIT-LICENSE'
,
'lib/**/*'
]
s
.
has_rdoc
=
true
...
...
actionmailer/lib/action_mailer/deprecated_api.rb
浏览文件 @
3829f9ec
...
...
@@ -19,6 +19,7 @@ def part(params)
end
part
=
Mail
::
Part
.
new
(
params
)
yield
part
if
block_given?
@parts
<<
part
end
...
...
@@ -29,7 +30,16 @@ def attachment(params, &block)
super
# Run deprecation hooks
params
=
{
:content_type
=>
params
}
if
String
===
params
params
=
{
:content_disposition
=>
"attachment"
,
if
filename
=
params
.
delete
(
:filename
)
content_disposition
=
"attachment; filename=
\"
#{
File
.
basename
(
filename
)
}
\"
"
else
content_disposition
=
"attachment"
end
params
[
:content
]
=
params
.
delete
(
:data
)
if
params
[
:data
]
params
=
{
:content_disposition
=>
content_disposition
,
:content_transfer_encoding
=>
"base64"
}.
merge
(
params
)
part
(
params
,
&
block
)
...
...
actionmailer/lib/action_mailer/tmail_compat.rb
浏览文件 @
3829f9ec
...
...
@@ -16,5 +16,10 @@ def transfer_encoding(value = nil)
end
end
def
original_filename
STDERR
.
puts
(
"Message#original_filename is deprecated, please call Message#filename.
\n
#{
caller
}
"
)
filename
end
end
end
\ No newline at end of file
actionmailer/test/base_test.rb
浏览文件 @
3829f9ec
...
...
@@ -42,12 +42,18 @@ class BaseTest < Test::Unit::TestCase
class
TestMailer
<
ActionMailer
::
Base
def
welcome
(
hash
=
{})
headers
[
'X-SPAM'
]
=
"Not SPAM"
hash
=
{
:to
=>
'mikel@test.lindsaar.net'
,
:from
=>
'jose@test.plataformatec.com'
,
:subject
=>
'The first email on new API!'
}.
merge!
(
hash
)
mail
(
hash
)
end
def
invoice
(
hash
=
{})
attachments
[
'invoice.pdf'
]
=
'This is test File content'
hash
=
{
:to
=>
'mikel@test.lindsaar.net'
,
:from
=>
'jose@test.plataformatec.com'
,
:subject
=>
'Your invoice is attached'
}.
merge!
(
hash
)
mail
(
hash
)
end
end
def
test_the_method_call_to_mail_does_not_raise_error
...
...
@@ -84,6 +90,25 @@ def test_should_allow_all_headers_set
# assert_equal("Not SPAM", email['X-SPAM'])
# end
def
test_should_allow_you_to_send_an_attachment
assert_nothing_raised
{
TestMailer
.
deliver_invoice
}
end
def
test_should_allow_you_to_send_an_attachment
email
=
TestMailer
.
deliver_invoice
assert_equal
(
1
,
email
.
attachments
.
length
)
end
def
test_should_allow_you_to_send_an_attachment
email
=
TestMailer
.
deliver_invoice
assert_equal
(
'invoice.pdf'
,
email
.
attachments
[
0
].
filename
)
end
def
test_should_allow_you_to_send_an_attachment
email
=
TestMailer
.
deliver_invoice
assert_equal
(
'This is test File content'
,
email
.
attachments
[
'invoice.pdf'
].
decoded
)
end
def
test_should_use_class_defaults
end
...
...
actionmailer/test/mail_service_test.rb
浏览文件 @
3829f9ec
...
...
@@ -898,6 +898,7 @@ def test_explicitly_multipart_messages
assert_equal
"iso-8859-1"
,
mail
.
parts
[
1
].
charset
assert_equal
"image/jpeg"
,
mail
.
parts
[
2
].
mime_type
assert_equal
"attachment"
,
mail
.
parts
[
2
][
:content_disposition
].
disposition_type
assert_equal
"foo.jpg"
,
mail
.
parts
[
2
][
:content_disposition
].
filename
assert_equal
"foo.jpg"
,
mail
.
parts
[
2
][
:content_type
].
filename
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录