diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-06 10:23:37 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-06 14:15:58 +0000 |
commit | 14bbd1d75840add4fd5f8c440b58ac465c306fb6 (patch) | |
tree | c37c381c453abfafdbf9f4ff121568f27b228079 /spec/lib/mail_handler/mail_handler_spec.rb | |
parent | d1e5ab85d271a7b90a5c76946a960747c639ad64 (diff) |
Move methods for getting the text out of attachments to the mail handler module.
Diffstat (limited to 'spec/lib/mail_handler/mail_handler_spec.rb')
-rw-r--r-- | spec/lib/mail_handler/mail_handler_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index 7eeba47e0..efa89b6e0 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -250,4 +250,24 @@ describe 'when getting header strings' do '9; Autoresponder') end -end
\ No newline at end of file +end + +describe "when parsing HTML mail" do + it "should display UTF-8 characters in the plain text version correctly" do + html = "<html><b>foo</b> është" + plain_text = MailHandler._get_attachment_text_internal_one_file('text/html', html) + plain_text.should match(/është/) + end + +end + +describe "when getting the attachment text" do + + it "should not raise an error if the expansion of a zip file raises an error" do + mock_entry = mock('ZipFile entry', :file? => true) + mock_entry.stub!(:get_input_stream).and_raise("invalid distance too far back") + Zip::ZipFile.stub!(:open).and_return([mock_entry]) + MailHandler._get_attachment_text_internal_one_file('application/zip', "some string") + end + +end |