class TestMailMultipart
Public Instance Methods
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/mail-multipart.rb, line 165 def test_all mail = QuickML::Mail.new # test_plain mail.body = 'body' ok_eq(['body'], mail.parts) # test_parts ok_eq(false, mail.multipart?) # test_multipart? # test_multi_part mail['Content-Type'] = "multipart/mixed; boundary=\"b\"" ok_eq(true, mail.multipart?) # test_multipart? ok_eq('b', mail.boundary) # test_boundary ok_eq([], mail.parts) # test_parts mail.body = '--b 1 --b 2 --b- ' ok_eq(["1\n", "2\n"], mail.parts) # test_parts # test_each_part mail.each_part {|mail| assert_match(/\A\d\n\z/, mail.bare) } end
test_class_method()
click to toggle source
# File vendor/qwik/lib/qwik/mail-multipart.rb, line 100 def test_class_method c = QuickML::Mail # test_boundary ok_eq('b', c.boundary("multipart/mixed; boundary=\"b\"")) # ref. https://www.codeblog.org/blog/ryu/?date=20060112#p01 # Thanks to Mr. Sato. ok_eq('b', c.boundary("multipart/signed; protocol=\"TYPE/STYPE\"; micalg=\"MICALG\"; boundary=\"b\"")) # test_split_body ok_eq(['body'], c.split_body('body', '')) ok_eq(["a\n", "b\n"], c.split_body(' --t a --t b ', 't')) ok_eq(["a\n", "b\n"], c.split_body(' --t a --t b --t-- ', 't')) ok_eq(["a\n", "b\n"], c.split_body(' --t a --t b --t-- ', 't')) # example. ok_eq(["a\n", "b\n"], c.split_body(' This is a multi-part message in MIME format. ------=_NextPart_000_006A_01C5C34A.53A389F0 a ------=_NextPart_000_006A_01C5C34A.53A389F0 b ------=_NextPart_000_006A_01C5C34A.53A389F0-- ', '----=_NextPart_000_006A_01C5C34A.53A389F0')) # test_get_filename ok_eq("\e$B$\"\e(B", 'あ'.set_sourcecode_charset.to_mail_charset) ok_eq('t', c.get_filename("Content-Disposition: attachment; filename=\"t\"")) ok_eq("\343\201\202", c.get_filename("Content-Disposition: attachment; filename=\"\e$B$\"\e(B\"")) ok_eq('sounds.zip', c.get_filename("Content-Disposition: attachment; filename=sounds.zip")) # $KCODE = 's' ok_eq('17fy予算コードの指定について.doc'.set_sourcecode_charset.to_filename_charset, c.get_filename('Content-Disposition: attachment; filename="=?ISO-2022-JP?B?MTdmeRskQk09OzslMyE8JUkkTjtYRGokSxsoQg==?= =?ISO-2022-JP?B?GyRCJEQkJCRGGyhCLmRvYw==?="')) ok_eq('情報流デザイングループ.xls'.set_sourcecode_charset.to_filename_charset, c.get_filename('Content-Disposition: attachment; filename="=?ISO-2022-JP?B?GyRCPnBKc04uJUclNiUkJXMlMCVrITwlVxsoQg==?= =?ISO-2022-JP?B?Lnhscw==?="')) end