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,99 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Object do
5
+
6
+ describe "blank method" do
7
+ it "should say nil is blank" do
8
+ nil.should be_blank
9
+ end
10
+
11
+ it "should say false is blank" do
12
+ false.should be_blank
13
+ end
14
+
15
+ it "should say true is not blank" do
16
+ true.should_not be_blank
17
+ end
18
+
19
+ it "should say an empty array is blank" do
20
+ [].should be_blank
21
+ end
22
+
23
+ it "should say an empty hash is blank" do
24
+ {}.should be_blank
25
+ end
26
+
27
+ it "should say an empty string is blank" do
28
+ ''.should be_blank
29
+ " ".should be_blank
30
+ a = ''; 1000.times { a << ' ' }
31
+ a.should be_blank
32
+ "\t \n\n".should be_blank
33
+ end
34
+ end
35
+
36
+ describe "not blank method" do
37
+ it "should say a number is not blank" do
38
+ 1.should_not be_blank
39
+ end
40
+
41
+ it "should say a valueless hash is not blank" do
42
+ {:one => nil, :two => nil}.should_not be_blank
43
+ end
44
+
45
+ it "should say a hash containing an empty hash is not blank" do
46
+ {:key => {}}.should_not be_blank
47
+ end
48
+ end
49
+
50
+ describe "to_lf method on String" do
51
+ it "should leave lf as lf" do
52
+ "\n".to_lf.should == "\n"
53
+ end
54
+
55
+ it "should clean just cr to lf" do
56
+ "\r".to_lf.should == "\n"
57
+ end
58
+
59
+ it "should leave crlf as lf" do
60
+ "\r\n".to_lf.should == "\n"
61
+ end
62
+
63
+ it "should handle japanese characters" do
64
+ string = "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
65
+ string.to_lf.should == "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\n\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\n\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\n\n"
66
+ end
67
+ end
68
+
69
+ describe "to_crlf method on String" do
70
+ it "should clean just lf to crlf" do
71
+ "\n".to_crlf.should == "\r\n"
72
+ end
73
+
74
+ it "should clean just cr to crlf" do
75
+ "\r".to_crlf.should == "\r\n"
76
+ end
77
+
78
+ it "should leave crlf as crlf" do
79
+ "\r\n".to_crlf.should == "\r\n"
80
+ end
81
+
82
+ it "should handle japanese characters" do
83
+ string = "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
84
+ string.to_crlf.should == "\343\201\202\343\201\210\343\201\206\343\201\210\343\201\212\r\n\r\n\343\201\213\343\201\215\343\201\217\343\201\221\343\201\223\r\n\r\n\343\201\225\343\201\227\343\201\244\343\201\233\343\201\235\r\n\r\n"
85
+ end
86
+
87
+ end
88
+
89
+ describe "methods on NilClass" do
90
+ it "should return empty string on to_crlf" do
91
+ nil.to_crlf.should == ''
92
+ end
93
+
94
+ it "should return empty string on to_lf" do
95
+ nil.to_lf.should == ''
96
+ end
97
+ end
98
+
99
+ end
@@ -0,0 +1,109 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Mail::AddressList do
5
+
6
+ describe "parsing" do
7
+ it "should parse an address list" do
8
+ parse_text = 'test@lindsaar.net'
9
+ doing { Mail::AddressList.new(parse_text) }.should_not raise_error
10
+ end
11
+
12
+ it "should raise an error if the input is useless" do
13
+ parse_text = '@@@@@@'
14
+ doing { Mail::AddressList.new(parse_text) }.should raise_error
15
+ end
16
+
17
+ it "should not raise an error if the input is just blank" do
18
+ parse_text = nil
19
+ doing { Mail::AddressList.new(parse_text) }.should_not raise_error
20
+ end
21
+
22
+ it "should raise an error if the input is useless" do
23
+ parse_text = "This ( is an invalid address!"
24
+ doing { Mail::AddressList.new(parse_text) }.should raise_error
25
+ end
26
+
27
+ it "should give the address passed in" do
28
+ parse_text = 'test@lindsaar.net'
29
+ result = 'test@lindsaar.net'
30
+ a = Mail::AddressList.new(parse_text)
31
+ a.addresses.first.to_s.should == result
32
+ end
33
+
34
+ it "should give the addresses passed in" do
35
+ parse_text = 'test@lindsaar.net, test2@lindsaar.net'
36
+ result = ['test@lindsaar.net', 'test2@lindsaar.net']
37
+ a = Mail::AddressList.new(parse_text)
38
+ a.addresses.map {|addr| addr.to_s }.should == result
39
+ end
40
+
41
+ it "should preserve the display name" do
42
+ parse_text = '"Mikel Lindsaar" <mikel@test.lindsaar.net>'
43
+ result = 'Mikel Lindsaar <mikel@test.lindsaar.net>'
44
+ a = Mail::AddressList.new(parse_text)
45
+ a.addresses.first.format.should == result
46
+ a.addresses.first.display_name.should == 'Mikel Lindsaar'
47
+ end
48
+
49
+ end
50
+
51
+ describe "functionality" do
52
+ it "should give back a list of address nodes" do
53
+ list = Mail::AddressList.new('mikel@me.com, bob@you.com')
54
+ list.address_nodes.length.should == 2
55
+ end
56
+
57
+ it "should have each nood a class of SyntaxNode" do
58
+ list = Mail::AddressList.new('mikel@me.com, bob@you.com')
59
+ list.address_nodes.each { |n| n.class.should == Treetop::Runtime::SyntaxNode }
60
+ end
61
+
62
+ it "should give a block of address nodes with groups" do
63
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
64
+ list.address_nodes.length.should == 2
65
+ end
66
+
67
+ it "should give all the recipients when asked" do
68
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
69
+ list.individual_recipients.length.should == 1
70
+ end
71
+
72
+ it "should give all the groups when asked" do
73
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
74
+ list.group_recipients.length.should == 1
75
+ end
76
+
77
+ it "should ask the group for all it's addresses" do
78
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
79
+ list.group_recipients.first.group_list.addresses.length.should == 2
80
+ end
81
+
82
+ it "should give all the addresses when asked" do
83
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
84
+ list.addresses.length.should == 3
85
+ end
86
+
87
+ it "should handle a really nasty obsolete address list" do
88
+ pending
89
+ psycho_obsolete = "Mary Smith <@machine.tld:mary@example.net>, , jdoe@test . example"
90
+ list = Mail::AddressList.new(psycho_obsolete)
91
+ list.addresses.length.should == 2
92
+ end
93
+
94
+
95
+ it "should create an address instance for each address returned" do
96
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
97
+ list.addresses.each do |address|
98
+ address.class.should == Mail::Address
99
+ end
100
+ end
101
+
102
+ it "should provide a list of group names" do
103
+ list = Mail::AddressList.new('sam@me.com, my_group: mikel@me.com, bob@you.com;')
104
+ list.group_names.should == ["my_group"]
105
+ end
106
+
107
+ end
108
+
109
+ end
@@ -0,0 +1,609 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Mail::Address do
5
+
6
+ describe "functionality" do
7
+
8
+ it "should allow us to instantiate an empty address object and call to_s" do
9
+ # doing {
10
+ Mail::Address.new.inspect
11
+ # }.should_not raise_error
12
+ end
13
+
14
+ it "should allow us to instantiate an empty address object and call inspect" do
15
+ # doing {
16
+ Mail::Address.new.inspect
17
+ # }.should_not raise_error
18
+ end
19
+
20
+ it "should allow us to instantiate an empty address object and call format" do
21
+ # doing {
22
+ Mail::Address.new.format
23
+ # }.should_not raise_error
24
+ end
25
+
26
+ it "should give it's address back on :to_s if there is no display name" do
27
+ parse_text = 'test@lindsaar.net'
28
+ result = 'test@lindsaar.net'
29
+ Mail::Address.new(parse_text).to_s.should == 'test@lindsaar.net'
30
+ end
31
+
32
+ it "should give it's format back on :to_s if there is a display name" do
33
+ parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
34
+ result = 'Mikel Lindsaar <test@lindsaar.net>'
35
+ Mail::Address.new(parse_text).to_s.should == 'Mikel Lindsaar <test@lindsaar.net>'
36
+ end
37
+
38
+ it "should give back the display name" do
39
+ parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
40
+ result = 'Mikel Lindsaar'
41
+ a = Mail::Address.new(parse_text)
42
+ a.display_name.should == result
43
+ end
44
+
45
+ it "should preserve the display name passed in" do
46
+ parse_text = '"Mikel Lindsaar" <mikel@test.lindsaar.net>'
47
+ result = 'Mikel Lindsaar'
48
+ a = Mail::Address.new(parse_text)
49
+ a.display_name.should == result
50
+ end
51
+
52
+ it "should preserve the display name passed in with token unsafe chars" do
53
+ parse_text = '"Mikel@@@Lindsaar" <mikel@test.lindsaar.net>'
54
+ result = 'Mikel@@@Lindsaar'
55
+ a = Mail::Address.new(parse_text)
56
+ a.display_name.should == result
57
+ end
58
+
59
+ it "should give back the local part" do
60
+ parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
61
+ result = 'test'
62
+ a = Mail::Address.new(parse_text)
63
+ a.local.should == result
64
+ end
65
+
66
+ it "should give back the domain" do
67
+ parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
68
+ result = 'lindsaar.net'
69
+ a = Mail::Address.new(parse_text)
70
+ a.domain.should == result
71
+ end
72
+
73
+ it "should give back the formated address" do
74
+ parse_text = 'Mikel Lindsaar <test@lindsaar.net>'
75
+ result = 'Mikel Lindsaar <test@lindsaar.net>'
76
+ a = Mail::Address.new(parse_text)
77
+ a.format.should == result
78
+ end
79
+
80
+ it "should handle an address without a domain" do
81
+ parse_text = 'test'
82
+ result = 'test'
83
+ a = Mail::Address.new(parse_text)
84
+ a.address.should == result
85
+ end
86
+
87
+ it "should handle comments" do
88
+ parse_text = "Mikel Lindsaar (author) <test@lindsaar.net>"
89
+ result = ['author']
90
+ a = Mail::Address.new(parse_text)
91
+ a.comments.should == result
92
+ end
93
+
94
+ it "should handle multiple comments" do
95
+ parse_text = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
96
+ result = ['first name', 'author']
97
+ a = Mail::Address.new(parse_text)
98
+ a.comments.should == result
99
+ end
100
+
101
+ it "should give back the raw value" do
102
+ parse_text = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
103
+ result = "Mikel (first name) Lindsaar (author) <test@lindsaar.net>"
104
+ a = Mail::Address.new(parse_text)
105
+ a.raw.should == result
106
+ end
107
+
108
+ end
109
+
110
+ describe "assigning values directly" do
111
+ it "should allow you to assign an address" do
112
+ a = Mail::Address.new
113
+ a.address = 'mikel@test.lindsaar.net'
114
+ a.address.should == 'mikel@test.lindsaar.net'
115
+ a.format.should == 'mikel@test.lindsaar.net'
116
+ end
117
+
118
+ it "should allow you to assign a display name" do
119
+ a = Mail::Address.new
120
+ a.display_name = 'Mikel Lindsaar'
121
+ a.display_name.should == 'Mikel Lindsaar'
122
+ end
123
+
124
+ it "should return an empty format a display name and no address defined" do
125
+ a = Mail::Address.new
126
+ a.display_name = 'Mikel Lindsaar'
127
+ a.format.should == ''
128
+ end
129
+
130
+ it "should allow you to assign an address and a display name" do
131
+ a = Mail::Address.new
132
+ a.address = 'mikel@test.lindsaar.net'
133
+ a.display_name = 'Mikel Lindsaar'
134
+ a.format.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
135
+ end
136
+ end
137
+
138
+ describe "parsing" do
139
+
140
+ describe "basic email addresses" do
141
+ it "should handle all OK local parts" do
142
+ [ [ 'aamine', 'aamine' ],
143
+ [ '"Minero Aoki"', '"Minero Aoki"' ],
144
+ [ '"!@#$%^&*()"', '"!@#$%^&*()"' ],
145
+ [ 'a.b.c', 'a.b.c' ]
146
+
147
+ ].each do |(words, ok)|
148
+ a = Mail::Address.new(words)
149
+ a.local.should == ok
150
+ end
151
+ end
152
+
153
+ it "should handle all OK domains" do
154
+ [ [ 'loveruby.net', 'loveruby.net' ],
155
+ [ '"love ruby".net', '"love ruby".net' ],
156
+ [ 'a."love ruby".net', 'a."love ruby".net' ],
157
+ [ '"!@#$%^&*()"', '"!@#$%^&*()"' ],
158
+ [ '[192.168.1.1]', '[192.168.1.1]' ]
159
+
160
+ ].each do |(words, ok)|
161
+ a = Mail::Address.new(%Q|me@#{words}|)
162
+ a.domain.should == ok
163
+ end
164
+ end
165
+ end
166
+
167
+ describe "email addresses from the wild" do
168
+ it "should handle |aamine@loveruby.net|" do
169
+ address = Mail::Address.new('aamine@loveruby.net')
170
+ address.should break_down_to({
171
+ :display_name => nil,
172
+ :address => 'aamine@loveruby.net',
173
+ :local => 'aamine',
174
+ :domain => 'loveruby.net',
175
+ :format => 'aamine@loveruby.net',
176
+ :comments => nil,
177
+ :raw => 'aamine@loveruby.net'})
178
+ end
179
+
180
+ it "should handle |Minero Aoki <aamine@loveruby.net>|" do
181
+ address = Mail::Address.new('Minero Aoki <aamine@loveruby.net>')
182
+ address.should break_down_to({
183
+ :display_name => 'Minero Aoki',
184
+ :address => 'aamine@loveruby.net',
185
+ :local => 'aamine',
186
+ :domain => 'loveruby.net',
187
+ :format => 'Minero Aoki <aamine@loveruby.net>',
188
+ :comments => nil,
189
+ :raw => 'Minero Aoki <aamine@loveruby.net>'})
190
+ end
191
+
192
+ it "should handle |Minero Aoki<aamine@loveruby.net>|" do
193
+ address = Mail::Address.new('Minero Aoki<aamine@loveruby.net>')
194
+ address.should break_down_to({
195
+ :display_name => 'Minero Aoki',
196
+ :address => 'aamine@loveruby.net',
197
+ :local => 'aamine',
198
+ :domain => 'loveruby.net',
199
+ :format => 'Minero Aoki <aamine@loveruby.net>',
200
+ :comments => nil,
201
+ :raw => 'Minero Aoki<aamine@loveruby.net>'})
202
+ end
203
+
204
+ it 'should handle |"Minero Aoki" <aamine@loveruby.net>|' do
205
+ address = Mail::Address.new('"Minero Aoki" <aamine@loveruby.net>')
206
+ address.should break_down_to({
207
+ :display_name => 'Minero Aoki',
208
+ :address => 'aamine@loveruby.net',
209
+ :local => 'aamine',
210
+ :domain => 'loveruby.net',
211
+ :format => 'Minero Aoki <aamine@loveruby.net>',
212
+ :comments => nil,
213
+ :raw => '"Minero Aoki" <aamine@loveruby.net>'})
214
+ end
215
+
216
+ it "should handle |Minero Aoki<aamine@0246.loveruby.net>|" do
217
+ address = Mail::Address.new('Minero Aoki<aamine@0246.loveruby.net>')
218
+ address.should break_down_to({
219
+ :display_name => 'Minero Aoki',
220
+ :address => 'aamine@0246.loveruby.net',
221
+ :local => 'aamine',
222
+ :domain => '0246.loveruby.net',
223
+ :format => 'Minero Aoki <aamine@0246.loveruby.net>',
224
+ :comments => nil,
225
+ :raw => 'Minero Aoki<aamine@0246.loveruby.net>'})
226
+ end
227
+
228
+ it "should handle lots of dots" do
229
+ 1.upto(10) do |times|
230
+ dots = "." * times
231
+ address = Mail::Address.new("hoge#{dots}test@docomo.ne.jp")
232
+ address.should break_down_to({
233
+ :display_name => nil,
234
+ :address => "hoge#{dots}test@docomo.ne.jp",
235
+ :local => "hoge#{dots}test",
236
+ :domain => 'docomo.ne.jp',
237
+ :format => "hoge#{dots}test@docomo.ne.jp",
238
+ :comments => nil,
239
+ :raw => "hoge#{dots}test@docomo.ne.jp"})
240
+ end
241
+ end
242
+
243
+ it 'should handle |"Joe & J. Harvey" <ddd @Org>|' do
244
+ address = Mail::Address.new('"Joe & J. Harvey" <ddd @Org>')
245
+ address.should break_down_to({
246
+ :name => 'Joe & J. Harvey',
247
+ :display_name => 'Joe & J. Harvey',
248
+ :address => 'ddd@Org',
249
+ :domain => 'Org',
250
+ :local => 'ddd',
251
+ :format => '"Joe & J. Harvey" <ddd@Org>',
252
+ :comments => nil,
253
+ :raw => '"Joe & J. Harvey" <ddd @Org>'})
254
+ end
255
+
256
+ it 'should handle |"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>|' do
257
+ address = Mail::Address.new('"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>')
258
+ address.should break_down_to({
259
+ :name => 'spickett@tiac.net',
260
+ :display_name => 'spickett@tiac.net',
261
+ :address => 'Sean.Pickett@zork.tiac.net',
262
+ :domain => 'zork.tiac.net',
263
+ :local => 'Sean.Pickett',
264
+ :format => '"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>',
265
+ :comments => nil,
266
+ :raw => '"spickett@tiac.net" <Sean.Pickett@zork.tiac.net>'})
267
+ end
268
+
269
+ it "should handle |rls@intgp8.ih.att.com (-Schieve,R.L.)|" do
270
+ address = Mail::Address.new('rls@intgp8.ih.att.com (-Schieve,R.L.)')
271
+ address.should break_down_to({
272
+ :name => '-Schieve,R.L.',
273
+ :display_name => nil,
274
+ :address => 'rls@intgp8.ih.att.com',
275
+ :comments => ['-Schieve,R.L.'],
276
+ :domain => 'intgp8.ih.att.com',
277
+ :local => 'rls',
278
+ :format => 'rls@intgp8.ih.att.com (-Schieve,R.L.)',
279
+ :raw => 'rls@intgp8.ih.att.com (-Schieve,R.L.)'})
280
+ end
281
+
282
+ it "should handle |jrh%cup.portal.com@portal.unix.portal.com|" do
283
+ address = Mail::Address.new('jrh%cup.portal.com@portal.unix.portal.com')
284
+ address.should break_down_to({
285
+ :name => nil,
286
+ :display_name => nil,
287
+ :address => 'jrh%cup.portal.com@portal.unix.portal.com',
288
+ :comments => nil,
289
+ :domain => 'portal.unix.portal.com',
290
+ :local => 'jrh%cup.portal.com',
291
+ :format => 'jrh%cup.portal.com@portal.unix.portal.com',
292
+ :raw => 'jrh%cup.portal.com@portal.unix.portal.com'})
293
+ end
294
+
295
+ it "should handle |astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')|" do
296
+ address = Mail::Address.new("astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')")
297
+ address.should break_down_to({
298
+ :name => "'paul astrachan/xvt3'",
299
+ :display_name => nil,
300
+ :address => 'astrachan@austlcm.sps.mot.com',
301
+ :comments => ["'paul astrachan/xvt3'"],
302
+ :domain => 'austlcm.sps.mot.com',
303
+ :local => 'astrachan',
304
+ :format => "astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')",
305
+ :raw => "astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3')"})
306
+ end
307
+
308
+ it "should handle 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)'" do
309
+ address = Mail::Address.new('TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)')
310
+ address.should break_down_to({
311
+ :name => 'JAMES R. TWINE - THE NERD',
312
+ :display_name => nil,
313
+ :address => 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU',
314
+ :comments => ['JAMES R. TWINE - THE NERD'],
315
+ :domain => 'SNYBUF.CS.SNYBUF.EDU',
316
+ :local => 'TWINE57%SDELVB.decnet',
317
+ :format => 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)',
318
+ :raw => 'TWINE57%SDELVB.decnet@SNYBUF.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD)'})
319
+ end
320
+
321
+ it "should be able to handle 'David Apfelbaum <da0g+@andrew.cmu.edu>'" do
322
+ address = Mail::Address.new('David Apfelbaum <da0g+@andrew.cmu.edu>')
323
+ address.should break_down_to({
324
+ :name => 'David Apfelbaum',
325
+ :display_name => 'David Apfelbaum',
326
+ :address => 'da0g+@andrew.cmu.edu',
327
+ :comments => nil,
328
+ :domain => 'andrew.cmu.edu',
329
+ :local => 'da0g+',
330
+ :format => 'David Apfelbaum <da0g+@andrew.cmu.edu>',
331
+ :raw => 'David Apfelbaum <da0g+@andrew.cmu.edu>'})
332
+ end
333
+
334
+ it 'should handle |"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>|' do
335
+ address = Mail::Address.new('"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>')
336
+ address.should break_down_to({
337
+ :name => 'JAMES R. TWINE - THE NERD',
338
+ :display_name => 'JAMES R. TWINE - THE NERD',
339
+ :address => 'TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU',
340
+ :comments => nil,
341
+ :domain => 'CUNYVM.CUNY.EDU',
342
+ :local => 'TWINE57%SDELVB%SNYDELVA.bitnet',
343
+ :format => '"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>',
344
+ :raw => '"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>'})
345
+ end
346
+
347
+ it "should handle '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk'" do
348
+ address = Mail::Address.new('/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk')
349
+ address.should break_down_to({
350
+ :name => nil,
351
+ :display_name => nil,
352
+ :address => '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk',
353
+ :comments => nil,
354
+ :domain => 'mhs-relay.ac.uk',
355
+ :local => '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/',
356
+ :format => '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk',
357
+ :raw => '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk'})
358
+ end
359
+
360
+ it 'should handle |"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>|' do
361
+ address = Mail::Address.new('"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>')
362
+ address.should break_down_to({
363
+ :name => 'Stephen Burke, Liverpool',
364
+ :display_name => 'Stephen Burke, Liverpool',
365
+ :address => 'BURKE@vxdsya.desy.de',
366
+ :comments => nil,
367
+ :domain => 'vxdsya.desy.de',
368
+ :local => 'BURKE',
369
+ :format => '"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>',
370
+ :raw => '"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>'})
371
+ end
372
+
373
+ it "should handle 'The Newcastle Info-Server <info-admin@newcastle.ac.uk>'" do
374
+ address = Mail::Address.new('The Newcastle Info-Server <info-admin@newcastle.ac.uk>')
375
+ address.should break_down_to({
376
+ :name => 'The Newcastle Info-Server',
377
+ :display_name => 'The Newcastle Info-Server',
378
+ :address => 'info-admin@newcastle.ac.uk',
379
+ :comments => nil,
380
+ :domain => 'newcastle.ac.uk',
381
+ :local => 'info-admin',
382
+ :format => 'The Newcastle Info-Server <info-admin@newcastle.ac.uk>',
383
+ :raw => 'The Newcastle Info-Server <info-admin@newcastle.ac.uk>'})
384
+ end
385
+
386
+ it "should handle 'Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])'" do
387
+ address = Mail::Address.new('Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])')
388
+ address.should break_down_to({
389
+ :name => 'Suba Peddada [CONTRACTOR]',
390
+ :display_name => nil,
391
+ :address => 'Suba.Peddada@eng.sun.com',
392
+ :comments => ['Suba Peddada [CONTRACTOR]'],
393
+ :domain => 'eng.sun.com',
394
+ :local => 'Suba.Peddada',
395
+ :format => 'Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])',
396
+ :raw => 'Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])'})
397
+ end
398
+
399
+ it "should handle 'Paul Manser (0032 memo) <a906187@tiuk.ti.com>'" do
400
+ address = Mail::Address.new('Paul Manser (0032 memo) <a906187@tiuk.ti.com>')
401
+ address.should break_down_to({
402
+ :name => 'Paul Manser',
403
+ :display_name => 'Paul Manser',
404
+ :address => 'a906187@tiuk.ti.com',
405
+ :comments => ['0032 memo'],
406
+ :domain => 'tiuk.ti.com',
407
+ :local => 'a906187',
408
+ :format => 'Paul Manser <a906187@tiuk.ti.com> (0032 memo)',
409
+ :raw => 'Paul Manser (0032 memo) <a906187@tiuk.ti.com>'})
410
+ end
411
+
412
+ it 'should handle |"gregg (g.) woodcock" <woodcock@bnr.ca>|' do
413
+ address = Mail::Address.new('"gregg (g.) woodcock" <woodcock@bnr.ca>')
414
+ address.should break_down_to({
415
+ :name => 'gregg (g.) woodcock',
416
+ :display_name => 'gregg (g.) woodcock',
417
+ :address => 'woodcock@bnr.ca',
418
+ :comments => nil,
419
+ :domain => 'bnr.ca',
420
+ :local => 'woodcock',
421
+ :format => '"gregg (g.) woodcock" <woodcock@bnr.ca>',
422
+ :raw => '"gregg (g.) woodcock" <woodcock@bnr.ca>'})
423
+ end
424
+
425
+ it 'should handle |Graham.Barr@tiuk.ti.com|' do
426
+ address = Mail::Address.new('Graham.Barr@tiuk.ti.com')
427
+ address.should break_down_to({
428
+ :name => nil,
429
+ :display_name => nil,
430
+ :address => 'Graham.Barr@tiuk.ti.com',
431
+ :comments => nil,
432
+ :domain => 'tiuk.ti.com',
433
+ :local => 'Graham.Barr',
434
+ :format => 'Graham.Barr@tiuk.ti.com',
435
+ :raw => 'Graham.Barr@tiuk.ti.com'})
436
+ end
437
+
438
+ it "should handle |a909937 (Graham Barr (0004 bodg))|" do
439
+ address = Mail::Address.new('a909937 (Graham Barr (0004 bodg))')
440
+ address.should break_down_to({
441
+ :name => 'Graham Barr (0004 bodg)',
442
+ :display_name => nil,
443
+ :address => 'a909937',
444
+ :comments => ['Graham Barr (0004 bodg)'],
445
+ :domain => nil,
446
+ :local => 'a909937',
447
+ :format => 'a909937 (Graham Barr \(0004 bodg\))',
448
+ :raw => 'a909937 (Graham Barr (0004 bodg))'})
449
+ end
450
+
451
+ it "should handle |david d `zoo' zuhn <zoo@aggregate.com>|" do
452
+ address = Mail::Address.new("david d `zoo' zuhn <zoo@aggregate.com>")
453
+ address.should break_down_to({
454
+ :name => "david d `zoo' zuhn",
455
+ :display_name => "david d `zoo' zuhn",
456
+ :address => 'zoo@aggregate.com',
457
+ :comments => nil,
458
+ :domain => 'aggregate.com',
459
+ :local => 'zoo',
460
+ :format => "david d `zoo' zuhn <zoo@aggregate.com>",
461
+ :raw => "david d `zoo' zuhn <zoo@aggregate.com>"})
462
+ end
463
+
464
+ it "should handle |(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>|" do
465
+ address = Mail::Address.new('(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>')
466
+ address.should break_down_to({
467
+ :name => 'foo@bar.com \(foobar\), ned@foo.com \(nedfoo\) ',
468
+ :display_name => '(foo@bar.com \(foobar\), ned@foo.com \(nedfoo\) )',
469
+ :address => 'kevin@goess.org',
470
+ :comments => ['foo@bar.com (foobar), ned@foo.com (nedfoo) '],
471
+ :domain => 'goess.org',
472
+ :local => 'kevin',
473
+ :format => '"(foo@bar.com \\(foobar\\), ned@foo.com \(nedfoo\) )" <kevin@goess.org> (foo@bar.com \(foobar\), ned@foo.com \(nedfoo\) )',
474
+ :raw => '(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>'})
475
+ end
476
+
477
+ it "should handle |Pete(A wonderful ) chap) <pete(his account)@silly.test(his host)>|" do
478
+ address = Mail::Address.new('Pete(A wonderful \) chap) <pete(his account)@silly.test(his host)>')
479
+ address.should break_down_to({
480
+ :name => 'Pete',
481
+ :display_name => 'Pete',
482
+ :address => 'pete(his account)@silly.test',
483
+ :comments => ['A wonderful \\) chap', 'his account', 'his host'],
484
+ :domain => 'silly.test',
485
+ :local => 'pete(his account)',
486
+ :format => 'Pete <pete(his account)@silly.test> (A wonderful \\) chap his account his host)',
487
+ :raw => 'Pete(A wonderful \\) chap) <pete(his account)@silly.test(his host)>'})
488
+ end
489
+
490
+ it "should handle |Joe Q. Public <john.q.public@example.com>|" do
491
+ address = Mail::Address.new('Joe Q. Public <john.q.public@example.com>')
492
+ address.should break_down_to({
493
+ :name => 'Joe Q. Public',
494
+ :display_name => 'Joe Q. Public',
495
+ :address => 'john.q.public@example.com',
496
+ :comments => nil,
497
+ :domain => 'example.com',
498
+ :local => 'john.q.public',
499
+ :format => '"Joe Q. Public" <john.q.public@example.com>',
500
+ :raw => 'Joe Q. Public <john.q.public@example.com>'})
501
+ end
502
+
503
+ it "should handle |Mary Smith <@machine.tld:mary@example.net>|" do
504
+ address = Mail::Address.new('Mary Smith <@machine.tld:mary@example.net>')
505
+ address.should break_down_to({
506
+ :name => 'Mary Smith',
507
+ :display_name => 'Mary Smith',
508
+ :address => '@machine.tld:mary@example.net',
509
+ :comments => nil,
510
+ :domain => 'example.net',
511
+ :local => '@machine.tld:mary',
512
+ :format => 'Mary Smith <@machine.tld:mary@example.net>',
513
+ :raw => 'Mary Smith <@machine.tld:mary@example.net>'})
514
+ end
515
+
516
+ it "should handle |jdoe@test . example|" do
517
+ pending
518
+ address = Mail::Address.new('jdoe@test . example')
519
+ address.should break_down_to({
520
+ :name => 'jdoe@test.example',
521
+ :display_name => 'jdoe@test.example',
522
+ :address => 'jdoe@test.example',
523
+ :comments => nil,
524
+ :domain => 'test.example',
525
+ :local => 'jdoe',
526
+ :format => 'jdoe@test.example',
527
+ :raw => 'jdoe@test.example'})
528
+ end
529
+
530
+ end
531
+
532
+ end
533
+
534
+ describe "creating" do
535
+
536
+ describe "parts of an address" do
537
+ it "should add an address" do
538
+ address = Mail::Address.new
539
+ address.address = "mikel@test.lindsaar.net"
540
+ address.should break_down_to({:address => 'mikel@test.lindsaar.net'})
541
+ end
542
+
543
+ it "should add a display name" do
544
+ address = Mail::Address.new
545
+ address.display_name = "Mikel Lindsaar"
546
+ address.display_name.should == 'Mikel Lindsaar'
547
+ end
548
+ end
549
+
550
+ end
551
+
552
+ describe "modifying an address" do
553
+ it "should add an address" do
554
+ address = Mail::Address.new
555
+ address.address = "mikel@test.lindsaar.net"
556
+ address.should break_down_to({:address => 'mikel@test.lindsaar.net'})
557
+ end
558
+
559
+ it "should add a display name" do
560
+ address = Mail::Address.new
561
+ address.display_name = "Mikel Lindsaar"
562
+ address.display_name.should == 'Mikel Lindsaar'
563
+ end
564
+
565
+ it "should take an address and a display name and join them" do
566
+ address = Mail::Address.new
567
+ address.address = "mikel@test.lindsaar.net"
568
+ address.display_name = "Mikel Lindsaar"
569
+ address.format.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
570
+ end
571
+
572
+ it "should take a display name and an address and join them" do
573
+ address = Mail::Address.new
574
+ address.display_name = "Mikel Lindsaar"
575
+ address.address = "mikel@test.lindsaar.net"
576
+ address.format.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
577
+ end
578
+
579
+ end
580
+
581
+ describe "providing encoded and decoded outputs" do
582
+ it "should provide an encoded output" do
583
+ address = Mail::Address.new
584
+ address.display_name = "Mikel Lindsaar"
585
+ address.address = "mikel@test.lindsaar.net"
586
+ address.encoded.should == 'Mikel Lindsaar <mikel@test.lindsaar.net>'
587
+ end
588
+
589
+ it "should provide an encoded output for non us-ascii" do
590
+ address = Mail::Address.new
591
+ address.display_name = "まける"
592
+ address.address = "mikel@test.lindsaar.net"
593
+ if RUBY_VERSION >= '1.9'
594
+ address.encoded.should == '=?UTF-8?B?44G+44GR44KL?= <mikel@test.lindsaar.net>'
595
+ else
596
+ address.encoded.should == '=?UTF8?B?44G+44GR44KL?= <mikel@test.lindsaar.net>'
597
+ end
598
+ end
599
+
600
+ it "should provide an encoded output for non us-ascii" do
601
+ address = Mail::Address.new
602
+ address.display_name = "まける"
603
+ address.address = "mikel@test.lindsaar.net"
604
+ address.decoded.should == '"まける" <mikel@test.lindsaar.net>'
605
+ end
606
+
607
+ end
608
+
609
+ end