actionmailer-rack-upgrade 2.3.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/CHANGELOG +387 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +149 -0
  4. data/Rakefile +97 -0
  5. data/install.rb +30 -0
  6. data/lib/action_mailer/adv_attr_accessor.rb +30 -0
  7. data/lib/action_mailer/base.rb +739 -0
  8. data/lib/action_mailer/helpers.rb +113 -0
  9. data/lib/action_mailer/mail_helper.rb +17 -0
  10. data/lib/action_mailer/part.rb +107 -0
  11. data/lib/action_mailer/part_container.rb +55 -0
  12. data/lib/action_mailer/quoting.rb +62 -0
  13. data/lib/action_mailer/test_case.rb +64 -0
  14. data/lib/action_mailer/test_helper.rb +68 -0
  15. data/lib/action_mailer/utils.rb +7 -0
  16. data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +1466 -0
  17. data/lib/action_mailer/vendor/text_format.rb +10 -0
  18. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +18 -0
  19. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +392 -0
  20. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +65 -0
  21. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +46 -0
  22. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +41 -0
  23. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +67 -0
  24. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +63 -0
  25. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +590 -0
  26. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +962 -0
  27. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +9 -0
  28. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +1162 -0
  29. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +3 -0
  30. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +578 -0
  31. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +496 -0
  32. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +6 -0
  33. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +3 -0
  34. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +250 -0
  35. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +132 -0
  36. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +1060 -0
  37. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +416 -0
  38. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +379 -0
  39. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +164 -0
  40. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +58 -0
  41. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +49 -0
  42. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +262 -0
  43. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +280 -0
  44. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +362 -0
  45. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +504 -0
  46. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +12 -0
  47. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
  48. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
  49. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
  50. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
  51. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
  52. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
  53. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
  54. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
  55. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
  56. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
  57. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
  58. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
  59. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
  60. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
  61. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
  62. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
  63. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
  64. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
  65. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
  66. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
  67. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
  68. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
  69. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
  70. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
  71. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
  72. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
  73. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
  74. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
  75. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
  76. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
  77. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
  78. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
  79. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +168 -0
  80. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
  81. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
  82. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +39 -0
  83. data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +6 -0
  84. data/lib/action_mailer/vendor/tmail.rb +17 -0
  85. data/lib/action_mailer/version.rb +9 -0
  86. data/lib/action_mailer.rb +62 -0
  87. data/lib/actionmailer.rb +2 -0
  88. data/test/abstract_unit.rb +62 -0
  89. data/test/asset_host_test.rb +54 -0
  90. data/test/delivery_method_test.rb +51 -0
  91. data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
  92. data/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
  93. data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +1 -0
  94. data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +1 -0
  95. data/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
  96. data/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
  97. data/test/fixtures/first_mailer/share.erb +1 -0
  98. data/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
  99. data/test/fixtures/helper_mailer/use_helper.erb +1 -0
  100. data/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
  101. data/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
  102. data/test/fixtures/helpers/example_helper.rb +5 -0
  103. data/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
  104. data/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
  105. data/test/fixtures/layouts/spam.html.erb +1 -0
  106. data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
  107. data/test/fixtures/raw_email +14 -0
  108. data/test/fixtures/raw_email10 +20 -0
  109. data/test/fixtures/raw_email12 +32 -0
  110. data/test/fixtures/raw_email13 +29 -0
  111. data/test/fixtures/raw_email2 +114 -0
  112. data/test/fixtures/raw_email3 +70 -0
  113. data/test/fixtures/raw_email4 +59 -0
  114. data/test/fixtures/raw_email5 +19 -0
  115. data/test/fixtures/raw_email6 +20 -0
  116. data/test/fixtures/raw_email7 +66 -0
  117. data/test/fixtures/raw_email8 +47 -0
  118. data/test/fixtures/raw_email9 +28 -0
  119. data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
  120. data/test/fixtures/raw_email_with_invalid_characters_in_content_type +104 -0
  121. data/test/fixtures/raw_email_with_nested_attachment +100 -0
  122. data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
  123. data/test/fixtures/second_mailer/share.erb +1 -0
  124. data/test/fixtures/templates/signed_up.erb +3 -0
  125. data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +1 -0
  126. data/test/fixtures/test_mailer/body_ivar.erb +2 -0
  127. data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +6 -0
  128. data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +6 -0
  129. data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
  130. data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
  131. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
  132. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +10 -0
  133. data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
  134. data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
  135. data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +1 -0
  136. data/test/fixtures/test_mailer/rxml_template.builder +2 -0
  137. data/test/fixtures/test_mailer/rxml_template.rxml +2 -0
  138. data/test/fixtures/test_mailer/signed_up.html.erb +3 -0
  139. data/test/fixtures/test_mailer/signed_up_with_url.erb +5 -0
  140. data/test/mail_helper_test.rb +95 -0
  141. data/test/mail_layout_test.rb +123 -0
  142. data/test/mail_render_test.rb +116 -0
  143. data/test/mail_service_test.rb +1145 -0
  144. data/test/quoting_test.rb +105 -0
  145. data/test/test_helper_test.rb +129 -0
  146. data/test/tmail_test.rb +22 -0
  147. data/test/url_test.rb +76 -0
  148. metadata +209 -0
@@ -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