Changeset 7476
- Timestamp:
- 09/14/07 05:30:52 (1 year ago)
- Files:
-
- trunk/actionmailer/CHANGELOG (modified) (1 diff)
- trunk/actionmailer/lib/action_mailer/vendor/tmail/base64.rb (modified) (1 diff)
- trunk/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb (modified) (1 diff)
- trunk/actionmailer/test/fixtures/raw_base64_decoded_string (added)
- trunk/actionmailer/test/fixtures/raw_base64_encoded_string (added)
- trunk/actionmailer/test/quoting_test.rb (modified) (2 diffs)
- trunk/actionmailer/test/tmail_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionmailer/CHANGELOG
r7070 r7476 1 1 *SVN* 2 3 * Fix attachment decoding when using the TMail C extension. #7861 [orangechicken] 2 4 3 5 * Increase mail delivery test coverage. #8692 [kamal] trunk/actionmailer/lib/action_mailer/vendor/tmail/base64.rb
r2634 r7476 43 43 44 44 def rb_decode( str, strict = false ) 45 str.unpack('m') 45 str.unpack('m').first 46 46 end 47 47 trunk/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb
r5080 r7476 79 79 80 80 def unquote_base64_and_convert_to(text, to, from) 81 convert_to(Base64.decode(text) .first, to, from)81 convert_to(Base64.decode(text), to, from) 82 82 end 83 83 trunk/actionmailer/test/quoting_test.rb
r5080 r7476 31 31 assert_equal "Re: Test: \"\346\274\242\345\255\227\" mid \"\346\274\242\345\255\227\" tail", mail.subject 32 32 end 33 34 def test_rb_decode 35 encoded, decoded = expected_base64_strings 36 assert_equal decoded, TMail::Base64.rb_decode(encoded) 37 end 38 39 def test_rb_encode 40 encoded, decoded = expected_base64_strings 41 assert_equal encoded.length, TMail::Base64.rb_encode(decoded).length 42 end 43 44 def test_rb_decode_should_match_c_decode_if_available 45 encoded, decoded = expected_base64_strings 46 47 begin 48 require 'tmail/base64.so' 49 assert_equal TMail::Base64.rb_decode(encoded), TMail::Base64.c_decode(encoded) 50 rescue LoadError 51 # No .so 52 end 53 end 54 55 def test_rb_encode_should_match_c_encode_if_available 56 encoded, decoded = expected_base64_strings 57 58 begin 59 require 'tmail/base64.so' 60 assert_equal TMail::Base64.rb_encode(decoded), TMail::Base64.c_encode(decoded) 61 rescue LoadError 62 # No .so 63 end 64 end 33 65 34 66 private 35 67 36 68 # This whole thing *could* be much simpler, but I don't think Tempfile, 37 69 # popen and others exist on all platforms (like Windows). … … 55 87 File.delete(res_name) rescue nil 56 88 end 89 90 def expected_base64_strings 91 [ File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_encoded_string"), File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_decoded_string") ] 92 end 57 93 end trunk/actionmailer/test/tmail_test.rb
r6207 r7476 17 17 assert_equal 2, mail.attachments.length 18 18 assert_equal "image/png", mail.attachments.first.content_type 19 assert_equal 1902, mail.attachments.first.length 19 20 assert_equal "application/pkcs7-signature", mail.attachments.last.content_type 20 21 end