From ca7bb3d9f7f7e38ca670dee4352a6c81e2b9d19a Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 15 Nov 2012 11:07:48 +0000 Subject: Move TMail monkey patch to MailHandler Tmail backend. --- spec/lib/mail_handler/mail_handler_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spec/lib/mail_handler/mail_handler_spec.rb (limited to 'spec/lib/mail_handler') diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb new file mode 100644 index 000000000..fa29132bc --- /dev/null +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -0,0 +1,16 @@ +# coding: utf-8 +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +def get_fixture_mail(filename) + MailHandler.mail_from_raw_email(load_file_fixture(filename)) +end + +describe 'when creating a mail object from raw data' do + + it 'should correctly parse a multipart email with a linebreak in the boundary' do + mail = get_fixture_mail('space-boundary.email') + mail.parts.size.should == 2 + mail.multipart?.should == true + end + +end -- cgit v1.2.3 From 23e99ffb72361161ef8cff4d0d79efca83326c80 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 15 Nov 2012 12:09:25 +0000 Subject: Factor out method for getting a mail object from a fixture file. --- spec/lib/mail_handler/mail_handler_spec.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'spec/lib/mail_handler') diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index fa29132bc..fc29817f6 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -1,10 +1,6 @@ # coding: utf-8 require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') -def get_fixture_mail(filename) - MailHandler.mail_from_raw_email(load_file_fixture(filename)) -end - describe 'when creating a mail object from raw data' do it 'should correctly parse a multipart email with a linebreak in the boundary' do -- cgit v1.2.3 From 4bdab94e9d4f0a64647e5f8534c1fea8b4ba2809 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 15 Nov 2012 14:04:55 +0000 Subject: Move TMail extensions to mail handler. --- spec/lib/mail_handler/mail_handler_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/lib/mail_handler') diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index fc29817f6..a3fba0698 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -9,4 +9,15 @@ describe 'when creating a mail object from raw data' do mail.multipart?.should == true end + it 'should parse multiple to addresses with unqoted display names' do + mail = get_fixture_mail('multiple-unquoted-display-names.email') + mail.to.should == ["request-66666-caa77777@whatdotheyknow.com", "foi@example.com"] + end + + it 'should convert an iso8859 email to utf8' do + mail = get_fixture_mail('iso8859_2_raw_email.email') + mail.subject.should have_text(/gjatë/u) + mail.body.is_utf8?.should == true + end + end -- cgit v1.2.3