rack-mail_exception 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (321) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +38 -0
  5. data/Rakefile +56 -0
  6. data/VERSION +1 -0
  7. data/lib/rack/mail_exception.rb +103 -0
  8. data/test/helper.rb +13 -0
  9. data/test/test_rack_mail_exception.rb +93 -0
  10. data/vendor/mail/.bundle/config +2 -0
  11. data/vendor/mail/CHANGELOG.rdoc +370 -0
  12. data/vendor/mail/Dependencies.txt +3 -0
  13. data/vendor/mail/Gemfile +17 -0
  14. data/vendor/mail/README.rdoc +572 -0
  15. data/vendor/mail/ROADMAP +92 -0
  16. data/vendor/mail/Rakefile +41 -0
  17. data/vendor/mail/TODO.rdoc +9 -0
  18. data/vendor/mail/lib/mail.rb +76 -0
  19. data/vendor/mail/lib/mail/attachments_list.rb +99 -0
  20. data/vendor/mail/lib/mail/body.rb +287 -0
  21. data/vendor/mail/lib/mail/configuration.rb +67 -0
  22. data/vendor/mail/lib/mail/core_extensions/blank.rb +26 -0
  23. data/vendor/mail/lib/mail/core_extensions/nil.rb +11 -0
  24. data/vendor/mail/lib/mail/core_extensions/string.rb +27 -0
  25. data/vendor/mail/lib/mail/elements.rb +14 -0
  26. data/vendor/mail/lib/mail/elements/address.rb +306 -0
  27. data/vendor/mail/lib/mail/elements/address_list.rb +74 -0
  28. data/vendor/mail/lib/mail/elements/content_disposition_element.rb +30 -0
  29. data/vendor/mail/lib/mail/elements/content_location_element.rb +25 -0
  30. data/vendor/mail/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
  31. data/vendor/mail/lib/mail/elements/content_type_element.rb +35 -0
  32. data/vendor/mail/lib/mail/elements/date_time_element.rb +26 -0
  33. data/vendor/mail/lib/mail/elements/envelope_from_element.rb +34 -0
  34. data/vendor/mail/lib/mail/elements/message_ids_element.rb +29 -0
  35. data/vendor/mail/lib/mail/elements/mime_version_element.rb +26 -0
  36. data/vendor/mail/lib/mail/elements/phrase_list.rb +21 -0
  37. data/vendor/mail/lib/mail/elements/received_element.rb +30 -0
  38. data/vendor/mail/lib/mail/encodings.rb +258 -0
  39. data/vendor/mail/lib/mail/encodings/7bit.rb +31 -0
  40. data/vendor/mail/lib/mail/encodings/8bit.rb +31 -0
  41. data/vendor/mail/lib/mail/encodings/base64.rb +33 -0
  42. data/vendor/mail/lib/mail/encodings/binary.rb +31 -0
  43. data/vendor/mail/lib/mail/encodings/quoted_printable.rb +38 -0
  44. data/vendor/mail/lib/mail/encodings/transfer_encoding.rb +58 -0
  45. data/vendor/mail/lib/mail/envelope.rb +35 -0
  46. data/vendor/mail/lib/mail/field.rb +223 -0
  47. data/vendor/mail/lib/mail/field_list.rb +33 -0
  48. data/vendor/mail/lib/mail/fields.rb +35 -0
  49. data/vendor/mail/lib/mail/fields/bcc_field.rb +56 -0
  50. data/vendor/mail/lib/mail/fields/cc_field.rb +55 -0
  51. data/vendor/mail/lib/mail/fields/comments_field.rb +41 -0
  52. data/vendor/mail/lib/mail/fields/common/address_container.rb +16 -0
  53. data/vendor/mail/lib/mail/fields/common/common_address.rb +125 -0
  54. data/vendor/mail/lib/mail/fields/common/common_date.rb +42 -0
  55. data/vendor/mail/lib/mail/fields/common/common_field.rb +50 -0
  56. data/vendor/mail/lib/mail/fields/common/common_message_id.rb +43 -0
  57. data/vendor/mail/lib/mail/fields/common/parameter_hash.rb +52 -0
  58. data/vendor/mail/lib/mail/fields/content_description_field.rb +19 -0
  59. data/vendor/mail/lib/mail/fields/content_disposition_field.rb +69 -0
  60. data/vendor/mail/lib/mail/fields/content_id_field.rb +63 -0
  61. data/vendor/mail/lib/mail/fields/content_location_field.rb +42 -0
  62. data/vendor/mail/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
  63. data/vendor/mail/lib/mail/fields/content_type_field.rb +185 -0
  64. data/vendor/mail/lib/mail/fields/date_field.rb +55 -0
  65. data/vendor/mail/lib/mail/fields/from_field.rb +55 -0
  66. data/vendor/mail/lib/mail/fields/in_reply_to_field.rb +55 -0
  67. data/vendor/mail/lib/mail/fields/keywords_field.rb +44 -0
  68. data/vendor/mail/lib/mail/fields/message_id_field.rb +83 -0
  69. data/vendor/mail/lib/mail/fields/mime_version_field.rb +53 -0
  70. data/vendor/mail/lib/mail/fields/optional_field.rb +13 -0
  71. data/vendor/mail/lib/mail/fields/received_field.rb +67 -0
  72. data/vendor/mail/lib/mail/fields/references_field.rb +55 -0
  73. data/vendor/mail/lib/mail/fields/reply_to_field.rb +55 -0
  74. data/vendor/mail/lib/mail/fields/resent_bcc_field.rb +55 -0
  75. data/vendor/mail/lib/mail/fields/resent_cc_field.rb +55 -0
  76. data/vendor/mail/lib/mail/fields/resent_date_field.rb +35 -0
  77. data/vendor/mail/lib/mail/fields/resent_from_field.rb +55 -0
  78. data/vendor/mail/lib/mail/fields/resent_message_id_field.rb +34 -0
  79. data/vendor/mail/lib/mail/fields/resent_sender_field.rb +62 -0
  80. data/vendor/mail/lib/mail/fields/resent_to_field.rb +55 -0
  81. data/vendor/mail/lib/mail/fields/return_path_field.rb +64 -0
  82. data/vendor/mail/lib/mail/fields/sender_field.rb +67 -0
  83. data/vendor/mail/lib/mail/fields/structured_field.rb +51 -0
  84. data/vendor/mail/lib/mail/fields/subject_field.rb +16 -0
  85. data/vendor/mail/lib/mail/fields/to_field.rb +55 -0
  86. data/vendor/mail/lib/mail/fields/unstructured_field.rb +166 -0
  87. data/vendor/mail/lib/mail/header.rb +262 -0
  88. data/vendor/mail/lib/mail/mail.rb +234 -0
  89. data/vendor/mail/lib/mail/message.rb +1867 -0
  90. data/vendor/mail/lib/mail/network.rb +9 -0
  91. data/vendor/mail/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
  92. data/vendor/mail/lib/mail/network/delivery_methods/sendmail.rb +62 -0
  93. data/vendor/mail/lib/mail/network/delivery_methods/smtp.rb +110 -0
  94. data/vendor/mail/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
  95. data/vendor/mail/lib/mail/network/retriever_methods/imap.rb +18 -0
  96. data/vendor/mail/lib/mail/network/retriever_methods/pop3.rb +149 -0
  97. data/vendor/mail/lib/mail/parsers/address_lists.rb +64 -0
  98. data/vendor/mail/lib/mail/parsers/address_lists.treetop +19 -0
  99. data/vendor/mail/lib/mail/parsers/content_disposition.rb +387 -0
  100. data/vendor/mail/lib/mail/parsers/content_disposition.treetop +46 -0
  101. data/vendor/mail/lib/mail/parsers/content_location.rb +139 -0
  102. data/vendor/mail/lib/mail/parsers/content_location.treetop +20 -0
  103. data/vendor/mail/lib/mail/parsers/content_transfer_encoding.rb +162 -0
  104. data/vendor/mail/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
  105. data/vendor/mail/lib/mail/parsers/content_type.rb +539 -0
  106. data/vendor/mail/lib/mail/parsers/content_type.treetop +58 -0
  107. data/vendor/mail/lib/mail/parsers/date_time.rb +114 -0
  108. data/vendor/mail/lib/mail/parsers/date_time.treetop +11 -0
  109. data/vendor/mail/lib/mail/parsers/envelope_from.rb +194 -0
  110. data/vendor/mail/lib/mail/parsers/envelope_from.treetop +32 -0
  111. data/vendor/mail/lib/mail/parsers/message_ids.rb +45 -0
  112. data/vendor/mail/lib/mail/parsers/message_ids.treetop +15 -0
  113. data/vendor/mail/lib/mail/parsers/mime_version.rb +144 -0
  114. data/vendor/mail/lib/mail/parsers/mime_version.treetop +19 -0
  115. data/vendor/mail/lib/mail/parsers/phrase_lists.rb +45 -0
  116. data/vendor/mail/lib/mail/parsers/phrase_lists.treetop +15 -0
  117. data/vendor/mail/lib/mail/parsers/received.rb +71 -0
  118. data/vendor/mail/lib/mail/parsers/received.treetop +11 -0
  119. data/vendor/mail/lib/mail/parsers/rfc2045.rb +464 -0
  120. data/vendor/mail/lib/mail/parsers/rfc2045.treetop +36 -0
  121. data/vendor/mail/lib/mail/parsers/rfc2822.rb +5318 -0
  122. data/vendor/mail/lib/mail/parsers/rfc2822.treetop +410 -0
  123. data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.rb +3757 -0
  124. data/vendor/mail/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
  125. data/vendor/mail/lib/mail/part.rb +102 -0
  126. data/vendor/mail/lib/mail/parts_list.rb +34 -0
  127. data/vendor/mail/lib/mail/patterns.rb +30 -0
  128. data/vendor/mail/lib/mail/utilities.rb +181 -0
  129. data/vendor/mail/lib/mail/version.rb +10 -0
  130. data/vendor/mail/lib/mail/version_specific/ruby_1_8.rb +97 -0
  131. data/vendor/mail/lib/mail/version_specific/ruby_1_9.rb +87 -0
  132. data/vendor/mail/lib/tasks/corpus.rake +125 -0
  133. data/vendor/mail/lib/tasks/treetop.rake +10 -0
  134. data/vendor/mail/mail.gemspec +20 -0
  135. data/vendor/mail/reference/US ASCII Table.txt +130 -0
  136. data/vendor/mail/reference/rfc1035 Domain Implementation and Specification.txt +3083 -0
  137. data/vendor/mail/reference/rfc1049 Content-Type Header Field for Internet Messages.txt +451 -0
  138. data/vendor/mail/reference/rfc1344 Implications of MIME for Internet Mail Gateways.txt +586 -0
  139. data/vendor/mail/reference/rfc1345 Character Mnemonics & Character Sets.txt +5761 -0
  140. data/vendor/mail/reference/rfc1524 A User Agent Configuration Mechanism For Multimedia Mail Format Information.txt +675 -0
  141. data/vendor/mail/reference/rfc1652 SMTP Service Extension for 8bit-MIMEtransport.txt +339 -0
  142. data/vendor/mail/reference/rfc1892 Multipart Report .txt +227 -0
  143. data/vendor/mail/reference/rfc1893 Mail System Status Codes.txt +843 -0
  144. data/vendor/mail/reference/rfc2045 Multipurpose Internet Mail Extensions (1).txt +1739 -0
  145. data/vendor/mail/reference/rfc2046 Multipurpose Internet Mail Extensions (2).txt +2467 -0
  146. data/vendor/mail/reference/rfc2047 Multipurpose Internet Mail Extensions (3).txt +843 -0
  147. data/vendor/mail/reference/rfc2048 Multipurpose Internet Mail Extensions (4).txt +1180 -0
  148. data/vendor/mail/reference/rfc2049 Multipurpose Internet Mail Extensions (5).txt +1347 -0
  149. data/vendor/mail/reference/rfc2111 Content-ID and Message-ID URLs.txt +283 -0
  150. data/vendor/mail/reference/rfc2183 Content-Disposition Header Field.txt +675 -0
  151. data/vendor/mail/reference/rfc2231 MIME Parameter Value and Encoded Word Extensions.txt +563 -0
  152. data/vendor/mail/reference/rfc2387 MIME Multipart-Related Content-type.txt +563 -0
  153. data/vendor/mail/reference/rfc2821 Simple Mail Transfer Protocol.txt +3711 -0
  154. data/vendor/mail/reference/rfc2822 Internet Message Format.txt +2859 -0
  155. data/vendor/mail/reference/rfc3462 Reporting of Mail System Administrative Messages.txt +396 -0
  156. data/vendor/mail/reference/rfc3696 Checking and Transformation of Names.txt +898 -0
  157. data/vendor/mail/reference/rfc4155 The application-mbox Media Type.txt +502 -0
  158. data/vendor/mail/reference/rfc4234 Augmented BNF for Syntax Specifications: ABNF.txt +899 -0
  159. data/vendor/mail/reference/rfc822 Standard for the Format of ARPA Internet Text Messages.txt +2900 -0
  160. data/vendor/mail/spec/environment.rb +15 -0
  161. data/vendor/mail/spec/features/making_a_new_message.feature +14 -0
  162. data/vendor/mail/spec/features/steps/env.rb +6 -0
  163. data/vendor/mail/spec/features/steps/making_a_new_message_steps.rb +11 -0
  164. data/vendor/mail/spec/fixtures/attachments/basic_email.eml +31 -0
  165. data/vendor/mail/spec/fixtures/attachments/test.gif +0 -0
  166. data/vendor/mail/spec/fixtures/attachments/test.jpg +0 -0
  167. data/vendor/mail/spec/fixtures/attachments/test.pdf +0 -0
  168. data/vendor/mail/spec/fixtures/attachments/test.png +0 -0
  169. data/vendor/mail/spec/fixtures/attachments/test.tiff +0 -0
  170. data/vendor/mail/spec/fixtures/attachments/test.zip +0 -0
  171. data/vendor/mail/spec/fixtures/attachments//343/201/246/343/201/231/343/201/250.txt +2 -0
  172. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_disposition.eml +29 -0
  173. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_content_location.eml +32 -0
  174. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_message_rfc822.eml +92 -0
  175. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_only_email.eml +17 -0
  176. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_pdf.eml +70 -0
  177. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_encoded_name.eml +47 -0
  178. data/vendor/mail/spec/fixtures/emails/attachment_emails/attachment_with_quoted_filename.eml +60 -0
  179. data/vendor/mail/spec/fixtures/emails/error_emails/cant_parse_from.eml +33 -0
  180. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_7-bit.eml +231 -0
  181. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_empty.eml +33 -0
  182. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_plain.eml +148 -0
  183. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_qp_with_space.eml +53 -0
  184. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_spam.eml +44 -0
  185. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_text-html.eml +50 -0
  186. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_8bits.eml +770 -0
  187. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_with_semi_colon.eml +269 -0
  188. data/vendor/mail/spec/fixtures/emails/error_emails/content_transfer_encoding_x_uuencode.eml +79 -0
  189. data/vendor/mail/spec/fixtures/emails/error_emails/empty_group_lists.eml +162 -0
  190. data/vendor/mail/spec/fixtures/emails/error_emails/header_fields_with_empty_values.eml +33 -0
  191. data/vendor/mail/spec/fixtures/emails/error_emails/missing_body.eml +16 -0
  192. data/vendor/mail/spec/fixtures/emails/error_emails/missing_content_disposition.eml +43 -0
  193. data/vendor/mail/spec/fixtures/emails/error_emails/multiple_content_types.eml +25 -0
  194. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email11.eml +34 -0
  195. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email12.eml +32 -0
  196. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email2.eml +114 -0
  197. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email4.eml +59 -0
  198. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email7.eml +66 -0
  199. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_encoded_stack_level_too_deep.eml +53 -0
  200. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_illegal_boundary.eml +58 -0
  201. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_mimepart_without_content_type.eml +94 -0
  202. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_multipart_mixed_quoted_boundary.eml +50 -0
  203. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_nested_attachment.eml +100 -0
  204. data/vendor/mail/spec/fixtures/emails/mime_emails/raw_email_with_quoted_illegal_boundary.eml +58 -0
  205. data/vendor/mail/spec/fixtures/emails/mime_emails/sig_only_email.eml +29 -0
  206. data/vendor/mail/spec/fixtures/emails/mime_emails/two_from_in_message.eml +42 -0
  207. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese.eml +9 -0
  208. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment.eml +27 -0
  209. data/vendor/mail/spec/fixtures/emails/multi_charset/japanese_attachment_long_name.eml +44 -0
  210. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce1.eml +179 -0
  211. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/multi_address_bounce2.eml +179 -0
  212. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_422.eml +98 -0
  213. data/vendor/mail/spec/fixtures/emails/multipart_report_emails/report_530.eml +97 -0
  214. data/vendor/mail/spec/fixtures/emails/plain_emails/basic_email.eml +31 -0
  215. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email.eml +14 -0
  216. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email10.eml +20 -0
  217. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email5.eml +19 -0
  218. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email6.eml +20 -0
  219. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email8.eml +47 -0
  220. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_bad_time.eml +62 -0
  221. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_double_at_in_header.eml +14 -0
  222. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_incorrect_header.eml +28 -0
  223. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_multiple_from.eml +30 -0
  224. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_quoted_with_0d0a.eml +14 -0
  225. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_reply.eml +32 -0
  226. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_simple.eml +11 -0
  227. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_string_in_date_field.eml +17 -0
  228. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_trailing_dot.eml +21 -0
  229. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_bad_date.eml +48 -0
  230. data/vendor/mail/spec/fixtures/emails/plain_emails/raw_email_with_partially_quoted_subject.eml +14 -0
  231. data/vendor/mail/spec/fixtures/emails/rfc2822/example01.eml +8 -0
  232. data/vendor/mail/spec/fixtures/emails/rfc2822/example02.eml +9 -0
  233. data/vendor/mail/spec/fixtures/emails/rfc2822/example03.eml +7 -0
  234. data/vendor/mail/spec/fixtures/emails/rfc2822/example04.eml +7 -0
  235. data/vendor/mail/spec/fixtures/emails/rfc2822/example05.eml +8 -0
  236. data/vendor/mail/spec/fixtures/emails/rfc2822/example06.eml +10 -0
  237. data/vendor/mail/spec/fixtures/emails/rfc2822/example07.eml +9 -0
  238. data/vendor/mail/spec/fixtures/emails/rfc2822/example08.eml +12 -0
  239. data/vendor/mail/spec/fixtures/emails/rfc2822/example09.eml +15 -0
  240. data/vendor/mail/spec/fixtures/emails/rfc2822/example10.eml +15 -0
  241. data/vendor/mail/spec/fixtures/emails/rfc2822/example11.eml +6 -0
  242. data/vendor/mail/spec/fixtures/emails/rfc2822/example12.eml +8 -0
  243. data/vendor/mail/spec/fixtures/emails/rfc2822/example13.eml +10 -0
  244. data/vendor/mail/spec/fixtures/emails/sample_output_multipart +0 -0
  245. data/vendor/mail/spec/mail/attachments_list_spec.rb +214 -0
  246. data/vendor/mail/spec/mail/body_spec.rb +385 -0
  247. data/vendor/mail/spec/mail/configuration_spec.rb +19 -0
  248. data/vendor/mail/spec/mail/core_extensions/string_spec.rb +62 -0
  249. data/vendor/mail/spec/mail/core_extensions_spec.rb +99 -0
  250. data/vendor/mail/spec/mail/elements/address_list_spec.rb +109 -0
  251. data/vendor/mail/spec/mail/elements/address_spec.rb +609 -0
  252. data/vendor/mail/spec/mail/elements/date_time_element_spec.rb +20 -0
  253. data/vendor/mail/spec/mail/elements/envelope_from_element_spec.rb +31 -0
  254. data/vendor/mail/spec/mail/elements/message_ids_element_spec.rb +43 -0
  255. data/vendor/mail/spec/mail/elements/phrase_list_spec.rb +22 -0
  256. data/vendor/mail/spec/mail/elements/received_element_spec.rb +34 -0
  257. data/vendor/mail/spec/mail/encoding_spec.rb +189 -0
  258. data/vendor/mail/spec/mail/encodings/base64_spec.rb +25 -0
  259. data/vendor/mail/spec/mail/encodings/quoted_printable_spec.rb +25 -0
  260. data/vendor/mail/spec/mail/encodings_spec.rb +664 -0
  261. data/vendor/mail/spec/mail/example_emails_spec.rb +303 -0
  262. data/vendor/mail/spec/mail/field_list_spec.rb +33 -0
  263. data/vendor/mail/spec/mail/field_spec.rb +198 -0
  264. data/vendor/mail/spec/mail/fields/bcc_field_spec.rb +89 -0
  265. data/vendor/mail/spec/mail/fields/cc_field_spec.rb +79 -0
  266. data/vendor/mail/spec/mail/fields/comments_field_spec.rb +25 -0
  267. data/vendor/mail/spec/mail/fields/common/address_container_spec.rb +18 -0
  268. data/vendor/mail/spec/mail/fields/common/common_address_spec.rb +132 -0
  269. data/vendor/mail/spec/mail/fields/common/common_date_spec.rb +25 -0
  270. data/vendor/mail/spec/mail/fields/common/common_field_spec.rb +69 -0
  271. data/vendor/mail/spec/mail/fields/common/common_message_id_spec.rb +30 -0
  272. data/vendor/mail/spec/mail/fields/common/parameter_hash_spec.rb +56 -0
  273. data/vendor/mail/spec/mail/fields/content_description_field_spec.rb +39 -0
  274. data/vendor/mail/spec/mail/fields/content_disposition_field_spec.rb +55 -0
  275. data/vendor/mail/spec/mail/fields/content_id_field_spec.rb +117 -0
  276. data/vendor/mail/spec/mail/fields/content_location_field_spec.rb +46 -0
  277. data/vendor/mail/spec/mail/fields/content_transfer_encoding_field_spec.rb +113 -0
  278. data/vendor/mail/spec/mail/fields/content_type_field_spec.rb +678 -0
  279. data/vendor/mail/spec/mail/fields/date_field_spec.rb +73 -0
  280. data/vendor/mail/spec/mail/fields/envelope_spec.rb +48 -0
  281. data/vendor/mail/spec/mail/fields/from_field_spec.rb +89 -0
  282. data/vendor/mail/spec/mail/fields/in_reply_to_field_spec.rb +62 -0
  283. data/vendor/mail/spec/mail/fields/keywords_field_spec.rb +66 -0
  284. data/vendor/mail/spec/mail/fields/message_id_field_spec.rb +147 -0
  285. data/vendor/mail/spec/mail/fields/mime_version_field_spec.rb +166 -0
  286. data/vendor/mail/spec/mail/fields/received_field_spec.rb +44 -0
  287. data/vendor/mail/spec/mail/fields/references_field_spec.rb +35 -0
  288. data/vendor/mail/spec/mail/fields/reply_to_field_spec.rb +67 -0
  289. data/vendor/mail/spec/mail/fields/resent_bcc_field_spec.rb +66 -0
  290. data/vendor/mail/spec/mail/fields/resent_cc_field_spec.rb +66 -0
  291. data/vendor/mail/spec/mail/fields/resent_date_field_spec.rb +39 -0
  292. data/vendor/mail/spec/mail/fields/resent_from_field_spec.rb +66 -0
  293. data/vendor/mail/spec/mail/fields/resent_message_id_field_spec.rb +24 -0
  294. data/vendor/mail/spec/mail/fields/resent_sender_field_spec.rb +58 -0
  295. data/vendor/mail/spec/mail/fields/resent_to_field_spec.rb +66 -0
  296. data/vendor/mail/spec/mail/fields/return_path_field_spec.rb +52 -0
  297. data/vendor/mail/spec/mail/fields/sender_field_spec.rb +58 -0
  298. data/vendor/mail/spec/mail/fields/structured_field_spec.rb +72 -0
  299. data/vendor/mail/spec/mail/fields/to_field_spec.rb +92 -0
  300. data/vendor/mail/spec/mail/fields/unstructured_field_spec.rb +134 -0
  301. data/vendor/mail/spec/mail/header_spec.rb +578 -0
  302. data/vendor/mail/spec/mail/mail_spec.rb +34 -0
  303. data/vendor/mail/spec/mail/message_spec.rb +1409 -0
  304. data/vendor/mail/spec/mail/mime_messages_spec.rb +435 -0
  305. data/vendor/mail/spec/mail/multipart_report_spec.rb +112 -0
  306. data/vendor/mail/spec/mail/network/delivery_methods/file_delivery_spec.rb +79 -0
  307. data/vendor/mail/spec/mail/network/delivery_methods/sendmail_spec.rb +125 -0
  308. data/vendor/mail/spec/mail/network/delivery_methods/smtp_spec.rb +133 -0
  309. data/vendor/mail/spec/mail/network/delivery_methods/test_mailer_spec.rb +57 -0
  310. data/vendor/mail/spec/mail/network/retriever_methods/pop3_spec.rb +180 -0
  311. data/vendor/mail/spec/mail/network_spec.rb +359 -0
  312. data/vendor/mail/spec/mail/parsers/address_lists_parser_spec.rb +15 -0
  313. data/vendor/mail/spec/mail/parsers/content_transfer_encoding_parser_spec.rb +72 -0
  314. data/vendor/mail/spec/mail/part_spec.rb +129 -0
  315. data/vendor/mail/spec/mail/parts_list_spec.rb +12 -0
  316. data/vendor/mail/spec/mail/round_tripping_spec.rb +44 -0
  317. data/vendor/mail/spec/mail/utilities_spec.rb +327 -0
  318. data/vendor/mail/spec/mail/version_specific/escape_paren_1_8_spec.rb +32 -0
  319. data/vendor/mail/spec/matchers/break_down_to.rb +35 -0
  320. data/vendor/mail/spec/spec_helper.rb +163 -0
  321. metadata +442 -0
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Mail::BccField do
5
+
6
+ # The "Bcc:" field (where the "Bcc" means "Blind Carbon Copy") contains
7
+ # addresses of recipients of the message whose addresses are not to be
8
+ # revealed to other recipients of the message. There are three ways in
9
+ # which the "Bcc:" field is used. In the first case, when a message
10
+ # containing a "Bcc:" field is prepared to be sent, the "Bcc:" line is
11
+ # removed even though all of the recipients (including those specified
12
+ # in the "Bcc:" field) are sent a copy of the message. In the second
13
+ # case, recipients specified in the "To:" and "Cc:" lines each are sent
14
+ # a copy of the message with the "Bcc:" line removed as above, but the
15
+ # recipients on the "Bcc:" line get a separate copy of the message
16
+ # containing a "Bcc:" line. (When there are multiple recipient
17
+ # addresses in the "Bcc:" field, some implementations actually send a
18
+ # separate copy of the message to each recipient with a "Bcc:"
19
+ # containing only the address of that particular recipient.) Finally,
20
+ # since a "Bcc:" field may contain no addresses, a "Bcc:" field can be
21
+ # sent without any addresses indicating to the recipients that blind
22
+ # copies were sent to someone. Which method to use with "Bcc:" fields
23
+ # is implementation dependent, but refer to the "Security
24
+ # Considerations" section of this document for a discussion of each.
25
+
26
+ describe "initialization" do
27
+
28
+ it "should initialize" do
29
+ doing { Mail::BccField.new("Bcc: Mikel") }.should_not raise_error
30
+ end
31
+
32
+ it "should mix in the CommonAddress module" do
33
+ Mail::BccField.included_modules.should include(Mail::CommonAddress)
34
+ end
35
+
36
+ it "should accept a string with the field name" do
37
+ t = Mail::BccField.new('Bcc: Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
38
+ t.name.should == 'Bcc'
39
+ t.value.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
40
+ end
41
+
42
+ it "should accept a string without the field name" do
43
+ t = Mail::BccField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
44
+ t.name.should == 'Bcc'
45
+ t.value.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
46
+ end
47
+
48
+ end
49
+
50
+ # Actual testing of CommonAddress methods occurs in the address field spec file
51
+
52
+ describe "instance methods" do
53
+ it "should return an address" do
54
+ t = Mail::BccField.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
55
+ t.formatted.should == ['Mikel Lindsaar <mikel@test.lindsaar.net>']
56
+ end
57
+
58
+ it "should return two addresses" do
59
+ t = Mail::BccField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, Ada Lindsaar <ada@test.lindsaar.net>')
60
+ t.formatted.first.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
61
+ t.addresses.last.should == 'ada@test.lindsaar.net'
62
+ end
63
+
64
+ it "should return one address and a group" do
65
+ t = Mail::BccField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
66
+ t.addresses[0].should == 'sam@me.com'
67
+ t.addresses[1].should == 'mikel@me.com'
68
+ t.addresses[2].should == 'bob@you.com'
69
+ end
70
+
71
+ it "should return the formatted line on to_s" do
72
+ t = Mail::BccField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
73
+ t.value.should == 'sam@me.com, my_group: mikel@me.com, bob@you.com;'
74
+ end
75
+
76
+ it "should return nothing on encoded as Bcc should not be in the mail" do
77
+ t = Mail::BccField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
78
+ t.encoded.should == ""
79
+ end
80
+
81
+ it "should return the decoded line" do
82
+ t = Mail::BccField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
83
+ t.decoded.should == "sam@me.com, my_group: mikel@me.com, bob@you.com;"
84
+ end
85
+
86
+ end
87
+
88
+
89
+ end
@@ -0,0 +1,79 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ # The "Cc:" field (where the "Cc" means "Carbon Copy" in the sense of
5
+ # making a copy on a typewriter using carbon paper) contains the
6
+ # addresses of others who are to receive the message, though the
7
+ # content of the message may not be directed at them.
8
+
9
+ describe Mail::CcField do
10
+
11
+ describe "initialization" do
12
+
13
+ it "should initialize" do
14
+ doing { Mail::CcField.new("Cc: Mikel") }.should_not raise_error
15
+ end
16
+
17
+ it "should mix in the CommonAddress module" do
18
+ Mail::CcField.included_modules.should include(Mail::CommonAddress)
19
+ end
20
+
21
+ it "should accept a string with the field name" do
22
+ t = Mail::CcField.new('Cc: Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
23
+ t.name.should == 'Cc'
24
+ t.value.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
25
+ end
26
+
27
+ it "should accept a string without the field name" do
28
+ t = Mail::CcField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
29
+ t.name.should == 'Cc'
30
+ t.value.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>'
31
+ end
32
+
33
+ end
34
+
35
+ # Actual testing of CommonAddress methods occurs in the address field spec file
36
+
37
+ describe "instance methods" do
38
+ it "should return an address" do
39
+ t = Mail::CcField.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
40
+ t.formatted.should == ['Mikel Lindsaar <mikel@test.lindsaar.net>']
41
+ end
42
+
43
+ it "should return two addresses" do
44
+ t = Mail::CcField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, Ada Lindsaar <ada@test.lindsaar.net>')
45
+ t.formatted.first.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
46
+ t.addresses.last.should == 'ada@test.lindsaar.net'
47
+ end
48
+
49
+ it "should return one address and a group" do
50
+ t = Mail::CcField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
51
+ t.addresses[0].should == 'sam@me.com'
52
+ t.addresses[1].should == 'mikel@me.com'
53
+ t.addresses[2].should == 'bob@you.com'
54
+ end
55
+
56
+ it "should return the formatted line on to_s" do
57
+ t = Mail::CcField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
58
+ t.value.should == 'sam@me.com, my_group: mikel@me.com, bob@you.com;'
59
+ end
60
+
61
+ it "should return the encoded line for one address" do
62
+ t = Mail::CcField.new('sam@me.com')
63
+ t.encoded.should == "Cc: sam@me.com\r\n"
64
+ end
65
+
66
+ it "should return the encoded line" do
67
+ t = Mail::CcField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
68
+ t.encoded.should == "Cc: sam@me.com, \r\n\tmy_group: mikel@me.com, \r\n\tbob@you.com;\r\n"
69
+ end
70
+
71
+ it "should return the decoded line" do
72
+ t = Mail::CcField.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
73
+ t.decoded.should == "sam@me.com, my_group: mikel@me.com, bob@you.com;"
74
+ end
75
+
76
+ end
77
+
78
+
79
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Mail::CommentsField do
5
+ #
6
+ # comments = "Comments:" unstructured CRLF
7
+
8
+ it "should initialize" do
9
+ doing { Mail::CommentsField.new("this is a comment") }.should_not raise_error
10
+ end
11
+
12
+ it "should accept a string with the field name" do
13
+ t = Mail::CommentsField.new('Comments: this is a comment')
14
+ t.name.should == 'Comments'
15
+ t.value.should == 'this is a comment'
16
+ end
17
+
18
+ it "should accept a string with the field name" do
19
+ t = Mail::CommentsField.new('this is a comment')
20
+ t.name.should == 'Comments'
21
+ t.value.should == 'this is a comment'
22
+ end
23
+
24
+
25
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe 'AddressContainer' do
5
+ it "should allow you to append an address to an address field result" do
6
+ m = Mail.new("To: mikel@test.lindsaar.net")
7
+ m.to.should == ['mikel@test.lindsaar.net']
8
+ m.to << 'bob@test.lindsaar.net'
9
+ m.to.should == ['mikel@test.lindsaar.net', 'bob@test.lindsaar.net']
10
+ end
11
+
12
+ it "should handle complex addresses correctly" do
13
+ m = Mail.new("From: mikel@test.lindsaar.net")
14
+ m.from.should == ['mikel@test.lindsaar.net']
15
+ m.from << '"Ada Lindsaar" <ada@test.lindsaar.net>, bob@test.lindsaar.net'
16
+ m.from.should == ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net', 'bob@test.lindsaar.net']
17
+ end
18
+ end
@@ -0,0 +1,132 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe "Mail::CommonAddress" do
5
+
6
+ describe "address handling" do
7
+
8
+ it "should give the addresses it is going to" do
9
+ field = Mail::ToField.new("To: test1@lindsaar.net")
10
+ field.addresses.first.should == "test1@lindsaar.net"
11
+ end
12
+
13
+ it "should split up the address list into individual addresses" do
14
+ field = Mail::ToField.new("To: test1@lindsaar.net, test2@lindsaar.net")
15
+ field.addresses.should == ["test1@lindsaar.net", "test2@lindsaar.net"]
16
+ end
17
+
18
+ it "should give the formatted addresses" do
19
+ field = Mail::ToField.new("To: Mikel <test1@lindsaar.net>, Bob <test2@lindsaar.net>")
20
+ field.formatted.should == ["Mikel <test1@lindsaar.net>", "Bob <test2@lindsaar.net>"]
21
+ end
22
+
23
+ it "should give the display names" do
24
+ field = Mail::ToField.new("To: Mikel <test1@lindsaar.net>, Bob <test2@lindsaar.net>")
25
+ field.display_names.should == ["Mikel", "Bob"]
26
+ end
27
+
28
+ it "should give the actual address objects" do
29
+ field = Mail::ToField.new("To: Mikel <test1@lindsaar.net>, Bob <test2@lindsaar.net>")
30
+ field.addrs.each do |addr|
31
+ addr.class.should == Mail::Address
32
+ end
33
+ end
34
+
35
+ it "should handle groups as well" do
36
+ field = Mail::ToField.new("To: test1@lindsaar.net, group: test2@lindsaar.net, me@lindsaar.net;")
37
+ field.addresses.should == ["test1@lindsaar.net", "test2@lindsaar.net", "me@lindsaar.net"]
38
+ end
39
+
40
+ it "should provide a list of groups" do
41
+ field = Mail::ToField.new("To: test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
42
+ field.group_names.should == ["My Group"]
43
+ end
44
+
45
+ it "should provide a list of addresses per group" do
46
+ field = Mail::ToField.new("To: test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
47
+ field.groups["My Group"].length.should == 2
48
+ field.groups["My Group"].first.to_s.should == 'test2@lindsaar.net'
49
+ field.groups["My Group"].last.to_s.should == 'me@lindsaar.net'
50
+ end
51
+
52
+ it "should provide a list of addresses that are just in the groups" do
53
+ field = Mail::ToField.new("To: test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
54
+ field.group_addresses.should == ['test2@lindsaar.net', 'me@lindsaar.net']
55
+ end
56
+
57
+ it "should handle initializing as an empty string" do
58
+ field = Mail::ToField.new("")
59
+ field.addresses.should == []
60
+ field.value = 'mikel@test.lindsaar.net'
61
+ field.addresses.should == ['mikel@test.lindsaar.net']
62
+ end
63
+
64
+ it "should encode to an empty string if it has no addresses or groups" do
65
+ field = Mail::ToField.new("")
66
+ field.encoded.should == ''
67
+ field.value = 'mikel@test.lindsaar.net'
68
+ field.encoded.should == "To: mikel@test.lindsaar.net\r\n"
69
+ end
70
+
71
+ it "should allow you to append an address" do
72
+ field = Mail::ToField.new("")
73
+ field << 'mikel@test.lindsaar.net'
74
+ field.addresses.should == ["mikel@test.lindsaar.net"]
75
+ end
76
+
77
+ it "should preserve the display name" do
78
+ field = Mail::ToField.new('"Mikel Lindsaar" <mikel@test.lindsaar.net>')
79
+ field.display_names.should == ["Mikel Lindsaar"]
80
+ end
81
+
82
+ it "should handle multiple addresses" do
83
+ field = Mail::ToField.new(['test1@lindsaar.net', 'Mikel <test2@lindsaar.net>'])
84
+ field.addresses.should == ['test1@lindsaar.net', 'test2@lindsaar.net']
85
+ end
86
+
87
+ end
88
+
89
+ describe "encoding and decoding fields" do
90
+
91
+ it "should allow us to encode an address field" do
92
+ field = Mail::ToField.new("test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
93
+ field.encoded.should == "To: test1@lindsaar.net, \r\n\tMy Group: test2@lindsaar.net, \r\n\tme@lindsaar.net;\r\n"
94
+ end
95
+
96
+ it "should allow us to encode a simple address field" do
97
+ field = Mail::ToField.new("test1@lindsaar.net")
98
+ field.encoded.should == "To: test1@lindsaar.net\r\n"
99
+ end
100
+
101
+ it "should allow us to encode an address field" do
102
+ field = Mail::CcField.new("test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
103
+ field.encoded.should == "Cc: test1@lindsaar.net, \r\n\tMy Group: test2@lindsaar.net, \r\n\tme@lindsaar.net;\r\n"
104
+ end
105
+
106
+ it "should allow us to decode an address field" do
107
+ field = Mail::ToField.new("test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;")
108
+ field.decoded.should == "test1@lindsaar.net, My Group: test2@lindsaar.net, me@lindsaar.net;"
109
+ end
110
+
111
+ it "should allow us to decode a non ascii address field" do
112
+ field = Mail::ToField.new("=?UTF-8?B?44G/44GR44KL?= <raasdnil@text.lindsaar.net>")
113
+ field.decoded.should == '"みける" <raasdnil@text.lindsaar.net>'
114
+ end
115
+
116
+ it "should allow us to decode a non ascii address field" do
117
+ field = Mail::ToField.new("=?UTF-8?B?44G/44GR44KL?= <raasdnil@text.lindsaar.net>, =?UTF-8?B?44G/44GR44KL?= <mikel@text.lindsaar.net>")
118
+ field.decoded.should == '"みける" <raasdnil@text.lindsaar.net>, "みける" <mikel@text.lindsaar.net>'
119
+ end
120
+
121
+ end
122
+
123
+ it "should yield each address object in turn" do
124
+ field = Mail::ToField.new("test1@lindsaar.net, test2@lindsaar.net, me@lindsaar.net")
125
+ addresses = []
126
+ field.each do |address|
127
+ addresses << address.address
128
+ end
129
+ addresses.should == ["test1@lindsaar.net", "test2@lindsaar.net", "me@lindsaar.net"]
130
+ end
131
+
132
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mail::CommonAddress do
4
+
5
+ describe "encoding and decoding fields" do
6
+
7
+ it "should allow us to encode an date field" do
8
+ field = Mail::DateField.new('12 Aug 2009 00:00:02 GMT')
9
+ field.encoded.should == "Date: Wed, 12 Aug 2009 00:00:02 +0000\r\n"
10
+ end
11
+
12
+ it "should allow us to encode an resent date field" do
13
+ field = Mail::ResentDateField.new('12 Aug 2009 00:00:02 GMT')
14
+ field.encoded.should == "Resent-Date: Wed, 12 Aug 2009 00:00:02 +0000\r\n"
15
+ end
16
+
17
+ it "should allow us to decode an address field" do
18
+ field = Mail::DateField.new('12 Aug 2009 00:00:02 GMT')
19
+ field.decoded.should == "Wed, 12 Aug 2009 00:00:02 +0000"
20
+ end
21
+
22
+ end
23
+
24
+
25
+ end
@@ -0,0 +1,69 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Mail::CommonField do
5
+
6
+ describe "multi-charset support" do
7
+
8
+ before(:each) do
9
+ @original = $KCODE if RUBY_VERSION < '1.9'
10
+ end
11
+
12
+ after(:each) do
13
+ $KCODE = @original if RUBY_VERSION < '1.9'
14
+ end
15
+
16
+ it "should leave ascii alone" do
17
+ field = Mail::SubjectField.new("This is a test")
18
+ field.encoded.should == "Subject: This is a test\r\n"
19
+ field.decoded.should == "This is a test"
20
+ end
21
+
22
+ it "should encode a utf-8 string as utf-8 quoted printable" do
23
+ value = "かきくけこ"
24
+ if RUBY_VERSION < '1.9'
25
+ $KCODE = 'u'
26
+ result = "Subject: =?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n"
27
+ else
28
+ value.force_encoding('UTF-8')
29
+ result = "Subject: =?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n"
30
+ end
31
+ field = Mail::SubjectField.new(value)
32
+ field.encoded.should == result
33
+ field.decoded.should == value
34
+ field.value.should == value
35
+ end
36
+
37
+ it "should wrap an encoded at 60 characters" do
38
+ value = "かきくけこ かきくけこ かきくけこ かきくけこ かきくけこ かきくけこ かきくけこ かきくけこ かきくけこ"
39
+ if RUBY_VERSION < '1.9'
40
+ $KCODE = 'u'
41
+ result = "Subject: =?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n"
42
+ else
43
+ value.force_encoding('UTF-8')
44
+ result = "Subject: =?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n\t=?UTF-8?Q?_=E3=81=8B=E3=81=8D=E3=81=8F=E3=81=91=E3=81=93=?=\r\n"
45
+ end
46
+ field = Mail::SubjectField.new(value)
47
+ field.encoded.should == result
48
+ field.decoded.should == value
49
+ field.value.should == value
50
+ end
51
+
52
+ it "should handle charsets in assigned addresses" do
53
+ value = '"かきくけこ" <mikel@test.lindsaar.net>'
54
+ if RUBY_VERSION < '1.9'
55
+ $KCODE = 'u'
56
+ result = "From: =?UTF-8?B?44GL44GN44GP44GR44GT?= <mikel@test.lindsaar.net>\r\n"
57
+ else
58
+ value.force_encoding('UTF-8')
59
+ result = "From: =?UTF-8?B?44GL44GN44GP44GR44GT?= <mikel@test.lindsaar.net>\r\n"
60
+ end
61
+ field = Mail::FromField.new(value)
62
+ field.encoded.should == result
63
+ field.decoded.should == value
64
+ field.value.should == "=?UTF-8?B?44GL44GN44GP44GR44GT?= <mikel@test.lindsaar.net>"
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'mail/fields/common/common_message_id'
3
+
4
+ describe Mail::CommonMessageId do
5
+
6
+ describe "encoding and decoding fields" do
7
+
8
+ it "should allow us to encode a message id field" do
9
+ field = Mail::MessageIdField.new('<ThisIsANonUniqueMessageId@me.com>')
10
+ field.encoded.should == "Message-ID: <ThisIsANonUniqueMessageId@me.com>\r\n"
11
+ end
12
+
13
+ it "should allow us to encode a message id field" do
14
+ field = Mail::MessageIdField.new('<1234@test.lindsaar.net>')
15
+ field.encoded.should == "Message-ID: <1234@test.lindsaar.net>\r\n"
16
+ end
17
+
18
+ it "should allow us to encode an in reply to field" do
19
+ field = Mail::InReplyToField.new('<1234@test.lindsaar.net>')
20
+ field.encoded.should == "In-Reply-To: <1234@test.lindsaar.net>\r\n"
21
+ end
22
+
23
+ it "should allow us to decode a message id field" do
24
+ field = Mail::MessageIdField.new('<1234@test.lindsaar.net>')
25
+ field.decoded.should == "<1234@test.lindsaar.net>"
26
+ end
27
+
28
+ end
29
+
30
+ end