actionmailer_csi 2.3.5.p6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +370 -0
- data/MIT-LICENSE +21 -0
- data/README +149 -0
- data/Rakefile +99 -0
- data/install.rb +30 -0
- data/lib/action_mailer/adv_attr_accessor.rb +30 -0
- data/lib/action_mailer/base.rb +706 -0
- data/lib/action_mailer/helpers.rb +113 -0
- data/lib/action_mailer/mail_helper.rb +17 -0
- data/lib/action_mailer/part.rb +107 -0
- data/lib/action_mailer/part_container.rb +55 -0
- data/lib/action_mailer/quoting.rb +61 -0
- data/lib/action_mailer/test_case.rb +64 -0
- data/lib/action_mailer/test_helper.rb +68 -0
- data/lib/action_mailer/utils.rb +7 -0
- data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +1466 -0
- data/lib/action_mailer/vendor/text_format.rb +10 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/address.rb +426 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/config.rb +67 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/header.rb +960 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/index.rb +9 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/main.rb +6 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb +248 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb +1478 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/port.rb +379 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail/version.rb +39 -0
- data/lib/action_mailer/vendor/tmail-1.2.3/tmail.rb +5 -0
- data/lib/action_mailer/vendor/tmail.rb +17 -0
- data/lib/action_mailer/version.rb +9 -0
- data/lib/action_mailer.rb +62 -0
- data/lib/actionmailer.rb +2 -0
- data/test/abstract_unit.rb +62 -0
- data/test/asset_host_test.rb +54 -0
- data/test/delivery_method_test.rb +51 -0
- data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
- data/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
- data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +1 -0
- data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +1 -0
- data/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
- data/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
- data/test/fixtures/first_mailer/share.erb +1 -0
- data/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
- data/test/fixtures/helper_mailer/use_helper.erb +1 -0
- data/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
- data/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
- data/test/fixtures/helpers/example_helper.rb +5 -0
- data/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
- data/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
- data/test/fixtures/layouts/spam.html.erb +1 -0
- data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
- data/test/fixtures/raw_email +14 -0
- data/test/fixtures/raw_email10 +20 -0
- data/test/fixtures/raw_email12 +32 -0
- data/test/fixtures/raw_email13 +29 -0
- data/test/fixtures/raw_email2 +114 -0
- data/test/fixtures/raw_email3 +70 -0
- data/test/fixtures/raw_email4 +59 -0
- data/test/fixtures/raw_email5 +19 -0
- data/test/fixtures/raw_email6 +20 -0
- data/test/fixtures/raw_email7 +66 -0
- data/test/fixtures/raw_email8 +47 -0
- data/test/fixtures/raw_email9 +28 -0
- data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
- data/test/fixtures/raw_email_with_invalid_characters_in_content_type +104 -0
- data/test/fixtures/raw_email_with_nested_attachment +100 -0
- data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
- data/test/fixtures/second_mailer/share.erb +1 -0
- data/test/fixtures/templates/signed_up.erb +3 -0
- data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +1 -0
- data/test/fixtures/test_mailer/body_ivar.erb +2 -0
- data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +6 -0
- data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +6 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +10 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
- data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +1 -0
- data/test/fixtures/test_mailer/rxml_template.builder +2 -0
- data/test/fixtures/test_mailer/rxml_template.rxml +2 -0
- data/test/fixtures/test_mailer/signed_up.html.erb +3 -0
- data/test/fixtures/test_mailer/signed_up_with_url.erb +5 -0
- data/test/mail_helper_test.rb +95 -0
- data/test/mail_layout_test.rb +123 -0
- data/test/mail_render_test.rb +116 -0
- data/test/mail_service_test.rb +1081 -0
- data/test/quoting_test.rb +99 -0
- data/test/test_helper_test.rb +129 -0
- data/test/tmail_test.rb +22 -0
- data/test/url_test.rb +76 -0
- metadata +195 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
From jamis@37signals.com Thu Feb 22 11:20:31 2007
|
|
2
|
+
Mime-Version: 1.0 (Apple Message framework v752.3)
|
|
3
|
+
Message-Id: <2CCE0408-10C7-4045-9B16-A1C11C31469B@37signals.com>
|
|
4
|
+
Content-Type: multipart/signed;
|
|
5
|
+
micalg=sha1;
|
|
6
|
+
boundary=Apple-Mail-42-587703407;
|
|
7
|
+
protocol="application/pkcs7-signature"
|
|
8
|
+
To: Jamis Buck <jamis@jamisbuck.org>
|
|
9
|
+
Subject: Testing attachments
|
|
10
|
+
From: Jamis Buck <jamis@37signals.com>
|
|
11
|
+
Date: Thu, 22 Feb 2007 11:20:31 -0700
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
--Apple-Mail-42-587703407
|
|
15
|
+
Content-Type: multipart/mixed;
|
|
16
|
+
boundary=Apple-Mail-41-587703287
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
--Apple-Mail-41-587703287
|
|
20
|
+
Content-Transfer-Encoding: 7bit
|
|
21
|
+
Content-Type: text/plain;
|
|
22
|
+
charset=US-ASCII;
|
|
23
|
+
format=flowed
|
|
24
|
+
|
|
25
|
+
Here is a test of an attachment via email.
|
|
26
|
+
|
|
27
|
+
- Jamis
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
--Apple-Mail-41-587703287
|
|
31
|
+
Content-Transfer-Encoding: base64
|
|
32
|
+
Content-Type: image/png;
|
|
33
|
+
x-unix-mode=0644;
|
|
34
|
+
name=byo-ror-cover.png
|
|
35
|
+
Content-Disposition: inline;
|
|
36
|
+
filename=truncated.png
|
|
37
|
+
|
|
38
|
+
iVBORw0KGgoAAAANSUhEUgAAAKUAAADXCAYAAAB7wZEQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
|
|
39
|
+
AAALEgAACxIB0t1+/AAAABd0RVh0Q3JlYXRpb24gVGltZQAxLzI1LzIwMDeD9CJVAAAAGHRFWHRT
|
|
40
|
+
b2Z0d2FyZQBBZG9iZSBGaXJld29ya3NPsx9OAAAyBWlUWHRYTUw6Y29tLmFkb2JlLnhtcDw/eHBh
|
|
41
|
+
Y2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1l
|
|
42
|
+
dGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1j
|
|
43
|
+
MDIwIDEuMjU1NzE2LCBUdWUgT2N0IDEwIDIwMDYgMjM6MTY6MzQiPgogICA8cmRmOlJERiB4bWxu
|
|
44
|
+
czpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAg
|
|
45
|
+
ICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0
|
|
46
|
+
dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZWF0b3JUb29sPkFk
|
|
47
|
+
b2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVE
|
|
48
|
+
YXRlPjIwMDctMDE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ISjvnzWqdgcWN8EJgjnNq+Z7ktOm9l2Nfth28EZi4
|
|
61
|
+
bG/we5JwxM+Tql47/D/X6b38I8/RyxvxPJrX6zvQbo3h9jyJx+C0ALX327QETHl5eYlaYCT5rPTb
|
|
62
|
+
+5/rAq26t3lKIxV/p88hq6ptngdgCzoPjJqndiLfc/6y5A14WeDFGNPct4iUsJBV2bYzLEV7m83s
|
|
63
|
+
6Rp63VPhHKC/g/LzaU9qexJRr56043JWinqAtfZqsSm1sjoznthl54dtCqv+uL4nIY+oYWuc3+nH
|
|
64
|
+
kGfn8b0HQpvOYLQAZUDanbJs3jQhITZEgdarZK+cO6ySlL13rut5nFaN23s7u3Snz6eRPTkCoc2/
|
|
65
|
+
Vp1zHfZVFpZ87FiMVLV1iqyK5rlzfji2GzjfDsodlD+Weo5UD4h6PwKqzQMqID0tq2VjjFVSMpis
|
|
66
|
+
ZLRAs7sePZBZAHI+gIanB8I7MD+femAceeUe2Kxa5jS950kZ1p5eNEdeX1+jFmSpZ+1EdWCsDcne
|
|
67
|
+
NPNgUHNw3aYpnzv9PGTX0uo94EtN9qq1rOdxe3kc79T8ukeHJJ8Fnxej6qlylbLLsjQLOy6Xy2a1
|
|
68
|
+
kefs/N+nM7+S7IG5/E5Yc7F003pWErLjbH0O5cGadiMptSB/DZ5U5DI9yeg5MFYyMj8lC/Y7/Xjq
|
|
69
|
+
OZlWcnpg9aQfXz2HRq+Wn5xOp6gN8tWq8R44e2pfyzLYemEgprst+XXk2Zj2nXlbsG05BprndTMv
|
|
70
|
+
C3QRaXczshhVsHnMgfYn80Y2g5JureA6wBasPeP7LkE/jvZMJAaf/g/U2RelHsisvan5FqweIAHg
|
|
71
|
+
Pwc7L68GxvVDAAAAAElFTkSuQmCC
|
|
72
|
+
|
|
73
|
+
--Apple-Mail-41-587703287--
|
|
74
|
+
|
|
75
|
+
--Apple-Mail-42-587703407
|
|
76
|
+
Content-Transfer-Encoding: base64
|
|
77
|
+
Content-Type: application/pkcs7-signature;
|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SXNzdWluZyBDQQIQWOcU1hfAMRlFZjkSR/OilTANBgkqhkiG9w0BAQEFAASCAQCfwQiC3v6/
|
|
94
|
+
yleRDGv3bJ4nQYQ+c3mz3+mn3Xi6uU35n3piwxZZaWRdmLyiXPvU+QReHpSf3l2qsEZM3sdE0XF9
|
|
95
|
+
eRul/+QTFJcDNXOEAxG1zC2Gpz+6c6RrX4Ou12Pwkp+pNrZWTSY/mZgdqcArupOBcZi7qBjoWcy5
|
|
96
|
+
wb54dfvSSjrjmqLbkH/E8ww/6gGQuU/xXpAUZgUrTmQHrNKeIdSh5oDkOxFaFWvnmb8Z/2ixKqW/
|
|
97
|
+
Ux6WqamyvBtTs/5YBEtnpZOk+uVoscYEUBhU+DVJ2OSvTdXSivMtBdXmGTsG22k+P1NGUHi/A7ev
|
|
98
|
+
xPaO0uk4V8xyjNlN4HPuGpkrlXwPAAAAAAAA
|
|
99
|
+
|
|
100
|
+
--Apple-Mail-42-587703407--
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
From jamis@37signals.com Mon May 2 16:07:05 2005
|
|
2
|
+
Mime-Version: 1.0 (Apple Message framework v622)
|
|
3
|
+
Content-Transfer-Encoding: base64
|
|
4
|
+
Message-Id: <d3b8cf8e49f04480850c28713a1f473e@37signals.com>
|
|
5
|
+
Content-Type: text/plain;
|
|
6
|
+
charset=EUC-KR;
|
|
7
|
+
format=flowed
|
|
8
|
+
To: jamis@37signals.com
|
|
9
|
+
From: Jamis Buck <jamis@37signals.com>
|
|
10
|
+
Subject: Re: Test: =?UTF-8?B?Iua8ouWtlyI=?= mid =?UTF-8?B?Iua8ouWtlyI=?= tail
|
|
11
|
+
Date: Mon, 2 May 2005 16:07:05 -0600
|
|
12
|
+
|
|
13
|
+
tOu6zrrQwMcguLbC+bChwfa3ziwgv+y4rrTCIMfPs6q01MC7ILnPvcC0z7TZLg0KDQrBpiDAzLin
|
|
14
|
+
wLogSmFtaXPA1LTPtNku
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
second mail
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let's go!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Ignored when searching for implicitly multipart parts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Ignored when searching for implicitly multipart parts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
yaml to: <%= @recipient %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hey Ho, <%= render :partial => "subtemplate" %>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require 'abstract_unit'
|
|
2
|
+
|
|
3
|
+
module MailerHelper
|
|
4
|
+
def person_name
|
|
5
|
+
"Mr. Joe Person"
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class HelperMailer < ActionMailer::Base
|
|
10
|
+
helper MailerHelper
|
|
11
|
+
helper :example
|
|
12
|
+
|
|
13
|
+
def use_helper(recipient)
|
|
14
|
+
recipients recipient
|
|
15
|
+
subject "using helpers"
|
|
16
|
+
from "tester@example.com"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def use_example_helper(recipient)
|
|
20
|
+
recipients recipient
|
|
21
|
+
subject "using helpers"
|
|
22
|
+
from "tester@example.com"
|
|
23
|
+
self.body = { :text => "emphasize me!" }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def use_mail_helper(recipient)
|
|
27
|
+
recipients recipient
|
|
28
|
+
subject "using mailing helpers"
|
|
29
|
+
from "tester@example.com"
|
|
30
|
+
self.body = { :text =>
|
|
31
|
+
"But soft! What light through yonder window breaks? It is the east, " +
|
|
32
|
+
"and Juliet is the sun. Arise, fair sun, and kill the envious moon, " +
|
|
33
|
+
"which is sick and pale with grief that thou, her maid, art far more " +
|
|
34
|
+
"fair than she. Be not her maid, for she is envious! Her vestal " +
|
|
35
|
+
"livery is but sick and green, and none but fools do wear it. Cast " +
|
|
36
|
+
"it off!"
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def use_helper_method(recipient)
|
|
41
|
+
recipients recipient
|
|
42
|
+
subject "using helpers"
|
|
43
|
+
from "tester@example.com"
|
|
44
|
+
self.body = { :text => "emphasize me!" }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def name_of_the_mailer_class
|
|
50
|
+
self.class.name
|
|
51
|
+
end
|
|
52
|
+
helper_method :name_of_the_mailer_class
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class MailerHelperTest < Test::Unit::TestCase
|
|
56
|
+
def new_mail( charset="utf-8" )
|
|
57
|
+
mail = TMail::Mail.new
|
|
58
|
+
mail.set_content_type "text", "plain", { "charset" => charset } if charset
|
|
59
|
+
mail
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def setup
|
|
63
|
+
set_delivery_method :test
|
|
64
|
+
ActionMailer::Base.perform_deliveries = true
|
|
65
|
+
ActionMailer::Base.deliveries = []
|
|
66
|
+
|
|
67
|
+
@recipient = 'test@localhost'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def teardown
|
|
71
|
+
restore_delivery_method
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_use_helper
|
|
75
|
+
mail = HelperMailer.create_use_helper(@recipient)
|
|
76
|
+
assert_match %r{Mr. Joe Person}, mail.encoded
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_use_example_helper
|
|
80
|
+
mail = HelperMailer.create_use_example_helper(@recipient)
|
|
81
|
+
assert_match %r{<em><strong><small>emphasize me!}, mail.encoded
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def test_use_helper_method
|
|
85
|
+
mail = HelperMailer.create_use_helper_method(@recipient)
|
|
86
|
+
assert_match %r{HelperMailer}, mail.encoded
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_use_mail_helper
|
|
90
|
+
mail = HelperMailer.create_use_mail_helper(@recipient)
|
|
91
|
+
assert_match %r{ But soft!}, mail.encoded
|
|
92
|
+
assert_match %r{east, and\n Juliet}, mail.encoded
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
require 'abstract_unit'
|
|
2
|
+
|
|
3
|
+
class AutoLayoutMailer < ActionMailer::Base
|
|
4
|
+
def hello(recipient)
|
|
5
|
+
recipients recipient
|
|
6
|
+
subject "You have a mail"
|
|
7
|
+
from "tester@example.com"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def spam(recipient)
|
|
11
|
+
recipients recipient
|
|
12
|
+
subject "You have a mail"
|
|
13
|
+
from "tester@example.com"
|
|
14
|
+
body render(:inline => "Hello, <%= @world %>", :layout => 'spam', :body => { :world => "Earth" })
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def nolayout(recipient)
|
|
18
|
+
recipients recipient
|
|
19
|
+
subject "You have a mail"
|
|
20
|
+
from "tester@example.com"
|
|
21
|
+
body render(:inline => "Hello, <%= @world %>", :layout => false, :body => { :world => "Earth" })
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def multipart(recipient, type = nil)
|
|
25
|
+
recipients recipient
|
|
26
|
+
subject "You have a mail"
|
|
27
|
+
from "tester@example.com"
|
|
28
|
+
|
|
29
|
+
content_type(type) if type
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class ExplicitLayoutMailer < ActionMailer::Base
|
|
34
|
+
layout 'spam', :except => [:logout]
|
|
35
|
+
|
|
36
|
+
def signup(recipient)
|
|
37
|
+
recipients recipient
|
|
38
|
+
subject "You have a mail"
|
|
39
|
+
from "tester@example.com"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def logout(recipient)
|
|
43
|
+
recipients recipient
|
|
44
|
+
subject "You have a mail"
|
|
45
|
+
from "tester@example.com"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class LayoutMailerTest < Test::Unit::TestCase
|
|
50
|
+
def setup
|
|
51
|
+
set_delivery_method :test
|
|
52
|
+
ActionMailer::Base.perform_deliveries = true
|
|
53
|
+
ActionMailer::Base.deliveries = []
|
|
54
|
+
|
|
55
|
+
@recipient = 'test@localhost'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def teardown
|
|
59
|
+
restore_delivery_method
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_should_pickup_default_layout
|
|
63
|
+
mail = AutoLayoutMailer.create_hello(@recipient)
|
|
64
|
+
assert_equal "Hello from layout Inside", mail.body.strip
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_should_pickup_multipart_layout
|
|
68
|
+
mail = AutoLayoutMailer.create_multipart(@recipient)
|
|
69
|
+
assert_equal "multipart/alternative", mail.content_type
|
|
70
|
+
assert_equal 2, mail.parts.size
|
|
71
|
+
|
|
72
|
+
assert_equal 'text/plain', mail.parts.first.content_type
|
|
73
|
+
assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body
|
|
74
|
+
|
|
75
|
+
assert_equal 'text/html', mail.parts.last.content_type
|
|
76
|
+
assert_equal "Hello from layout text/html multipart", mail.parts.last.body
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_should_pickup_multipartmixed_layout
|
|
80
|
+
mail = AutoLayoutMailer.create_multipart(@recipient, "multipart/mixed")
|
|
81
|
+
assert_equal "multipart/mixed", mail.content_type
|
|
82
|
+
assert_equal 2, mail.parts.size
|
|
83
|
+
|
|
84
|
+
assert_equal 'text/plain', mail.parts.first.content_type
|
|
85
|
+
assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body
|
|
86
|
+
|
|
87
|
+
assert_equal 'text/html', mail.parts.last.content_type
|
|
88
|
+
assert_equal "Hello from layout text/html multipart", mail.parts.last.body
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_should_fix_multipart_layout
|
|
92
|
+
mail = AutoLayoutMailer.create_multipart(@recipient, "text/plain")
|
|
93
|
+
assert_equal "multipart/alternative", mail.content_type
|
|
94
|
+
assert_equal 2, mail.parts.size
|
|
95
|
+
|
|
96
|
+
assert_equal 'text/plain', mail.parts.first.content_type
|
|
97
|
+
assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body
|
|
98
|
+
|
|
99
|
+
assert_equal 'text/html', mail.parts.last.content_type
|
|
100
|
+
assert_equal "Hello from layout text/html multipart", mail.parts.last.body
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_should_pickup_layout_given_to_render
|
|
105
|
+
mail = AutoLayoutMailer.create_spam(@recipient)
|
|
106
|
+
assert_equal "Spammer layout Hello, Earth", mail.body.strip
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_should_respect_layout_false
|
|
110
|
+
mail = AutoLayoutMailer.create_nolayout(@recipient)
|
|
111
|
+
assert_equal "Hello, Earth", mail.body.strip
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_explicit_class_layout
|
|
115
|
+
mail = ExplicitLayoutMailer.create_signup(@recipient)
|
|
116
|
+
assert_equal "Spammer layout We do not spam", mail.body.strip
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_explicit_layout_exceptions
|
|
120
|
+
mail = ExplicitLayoutMailer.create_logout(@recipient)
|
|
121
|
+
assert_equal "You logged out", mail.body.strip
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'abstract_unit'
|
|
2
|
+
|
|
3
|
+
class RenderMailer < ActionMailer::Base
|
|
4
|
+
def inline_template(recipient)
|
|
5
|
+
recipients recipient
|
|
6
|
+
subject "using helpers"
|
|
7
|
+
from "tester@example.com"
|
|
8
|
+
body render(:inline => "Hello, <%= @world %>", :body => { :world => "Earth" })
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def file_template(recipient)
|
|
12
|
+
recipients recipient
|
|
13
|
+
subject "using helpers"
|
|
14
|
+
from "tester@example.com"
|
|
15
|
+
body render(:file => "signed_up", :body => { :recipient => recipient })
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def rxml_template(recipient)
|
|
19
|
+
recipients recipient
|
|
20
|
+
subject "rendering rxml template"
|
|
21
|
+
from "tester@example.com"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def included_subtemplate(recipient)
|
|
25
|
+
recipients recipient
|
|
26
|
+
subject "Including another template in the one being rendered"
|
|
27
|
+
from "tester@example.com"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def included_old_subtemplate(recipient)
|
|
31
|
+
recipients recipient
|
|
32
|
+
subject "Including another template in the one being rendered"
|
|
33
|
+
from "tester@example.com"
|
|
34
|
+
body render(:inline => "Hello, <%= render \"subtemplate\" %>", :body => { :world => "Earth" })
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def initialize_defaults(method_name)
|
|
38
|
+
super
|
|
39
|
+
mailer_name "test_mailer"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class FirstMailer < ActionMailer::Base
|
|
44
|
+
def share(recipient)
|
|
45
|
+
recipients recipient
|
|
46
|
+
subject "using helpers"
|
|
47
|
+
from "tester@example.com"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class SecondMailer < ActionMailer::Base
|
|
52
|
+
def share(recipient)
|
|
53
|
+
recipients recipient
|
|
54
|
+
subject "using helpers"
|
|
55
|
+
from "tester@example.com"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class RenderHelperTest < Test::Unit::TestCase
|
|
60
|
+
def setup
|
|
61
|
+
set_delivery_method :test
|
|
62
|
+
ActionMailer::Base.perform_deliveries = true
|
|
63
|
+
ActionMailer::Base.deliveries = []
|
|
64
|
+
|
|
65
|
+
@recipient = 'test@localhost'
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def teardown
|
|
69
|
+
restore_delivery_method
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_inline_template
|
|
73
|
+
mail = RenderMailer.create_inline_template(@recipient)
|
|
74
|
+
assert_equal "Hello, Earth", mail.body.strip
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_file_template
|
|
78
|
+
mail = RenderMailer.create_file_template(@recipient)
|
|
79
|
+
assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def test_rxml_template
|
|
83
|
+
mail = RenderMailer.deliver_rxml_template(@recipient)
|
|
84
|
+
assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_included_subtemplate
|
|
88
|
+
mail = RenderMailer.deliver_included_subtemplate(@recipient)
|
|
89
|
+
assert_equal "Hey Ho, let's go!", mail.body.strip
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
class FirstSecondHelperTest < Test::Unit::TestCase
|
|
94
|
+
def setup
|
|
95
|
+
set_delivery_method :test
|
|
96
|
+
ActionMailer::Base.perform_deliveries = true
|
|
97
|
+
ActionMailer::Base.deliveries = []
|
|
98
|
+
|
|
99
|
+
@recipient = 'test@localhost'
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def teardown
|
|
103
|
+
restore_delivery_method
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_ordering
|
|
107
|
+
mail = FirstMailer.create_share(@recipient)
|
|
108
|
+
assert_equal "first mail", mail.body.strip
|
|
109
|
+
mail = SecondMailer.create_share(@recipient)
|
|
110
|
+
assert_equal "second mail", mail.body.strip
|
|
111
|
+
mail = FirstMailer.create_share(@recipient)
|
|
112
|
+
assert_equal "first mail", mail.body.strip
|
|
113
|
+
mail = SecondMailer.create_share(@recipient)
|
|
114
|
+
assert_equal "second mail", mail.body.strip
|
|
115
|
+
end
|
|
116
|
+
end
|