forked from aquasync/ruby-msg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove previous fix - see comments at aquasync#5 (comment)
- Loading branch information
Showing
2 changed files
with
28 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,39 +9,36 @@ | |
require 'mapi/convert' | ||
|
||
class TestMsg < Test::Unit::TestCase | ||
def test_blammo | ||
Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg| | ||
assert_equal '"TripleNickel" <[email protected]>', msg.from | ||
assert_equal 'BlammoBlammo', msg.subject | ||
assert_equal 0, msg.recipients.length | ||
assert_equal 0, msg.attachments.length | ||
# this is all properties | ||
assert_equal 66, msg.properties.raw.length | ||
# this is unique named properties | ||
assert_equal 48, msg.properties.to_h.length | ||
# test accessing the named property keys - same name but different namespace | ||
assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')] | ||
assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')] | ||
end | ||
end | ||
def test_blammo | ||
Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg| | ||
assert_equal '"TripleNickel" <[email protected]>', msg.from | ||
assert_equal 'BlammoBlammo', msg.subject | ||
assert_equal 0, msg.recipients.length | ||
assert_equal 0, msg.attachments.length | ||
# this is all properties | ||
assert_equal 66, msg.properties.raw.length | ||
# this is unique named properties | ||
assert_equal 48, msg.properties.to_h.length | ||
# test accessing the named property keys - same name but different namespace | ||
assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')] | ||
assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')] | ||
end | ||
end | ||
|
||
|
||
def test_rtf_to_html_returns_valid_utf8 | ||
msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg| | ||
assert_equal 1, msg.recipients.length | ||
assert_equal 3, msg.attachments.length | ||
html_part = msg.to_mime.parts[0].parts[1].to_s | ||
if html_part.respond_to?(:encoding) | ||
assert_equal 'UTF-8', html_part.encoding.to_s | ||
assert html_part.valid_encoding? | ||
end | ||
end | ||
end | ||
def test_rendered_string_is_valid_encoding | ||
msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg| | ||
string_version = msg.to_mime.to_s | ||
if string_version.respond_to?(:valid_encoding?) | ||
assert_equal true, msg.to_mime.to_s.valid_encoding? | ||
end | ||
end | ||
end | ||
|
||
def test_embedded_msg_renders_as_string | ||
msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg| | ||
assert_match "message/rfc822", msg.to_mime.to_s | ||
end | ||
end | ||
def test_embedded_msg_renders_as_string | ||
msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg| | ||
assert_match "message/rfc822", msg.to_mime.to_s | ||
end | ||
end | ||
end | ||
|