aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/mail_handler
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/mail_handler')
-rw-r--r--spec/lib/mail_handler/backends/mail_backend_spec.rb11
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb6
2 files changed, 13 insertions, 4 deletions
diff --git a/spec/lib/mail_handler/backends/mail_backend_spec.rb b/spec/lib/mail_handler/backends/mail_backend_spec.rb
index eb1d4b167..91d9e1b5a 100644
--- a/spec/lib/mail_handler/backends/mail_backend_spec.rb
+++ b/spec/lib/mail_handler/backends/mail_backend_spec.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '../../../../spec_helper')
describe MailHandler::Backends::MailBackend do
@@ -37,6 +37,15 @@ describe MailHandler::Backends::MailBackend do
get_part_file_name(part).should be_nil
end
+ it 'turns an invalid UTF-8 name into a valid one' do
+ mail = get_fixture_mail('non-utf8-filename.email')
+ part = mail.attachments.first
+ filename = get_part_file_name(part)
+ if filename.respond_to?(:valid_encoding)
+ filename.valid_encoding?.should == true
+ end
+ end
+
end
describe :get_part_body do
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index be6da5c4f..27a7a3db4 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -1,4 +1,4 @@
-# coding: utf-8
+# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
def create_message_from(from_field)
@@ -9,7 +9,7 @@ end
describe 'when creating a mail object from raw data' do
- it "should be able to parse a large email without raising an exception", :focus => true do
+ it "should be able to parse a large email without raising an exception" do
m = Mail.new
m.add_file(:filename => "attachment.data", :content => "a" * (8 * 1024 * 1024))
raw_email = "From jamis_buck@byu.edu Mon May 2 16:07:05 2005\r\n#{m.to_s}"
@@ -22,7 +22,7 @@ describe 'when creating a mail object from raw data' do
mail.multipart?.should == true
end
- it "should not fail on invalid byte sequence in content-disposition header", :focus => true do
+ it "should not fail on invalid byte sequence in content-disposition header" do
part = Mail::Part.new("Content-Disposition: inline; filename=a\xB8z\r\n\r\nThis is the body text.")
lambda { part.inline? }.should_not raise_error
end