diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-06 17:11:15 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-06 17:11:15 +0000 |
commit | 24648c4b8f0bfbcbb3cf0d192b28906a9b7e111c (patch) | |
tree | 554308dd3fa334b288eba156f8ff3d8217d4fd59 /spec/lib | |
parent | b509a63712cfb7fb9729a4cf60409ae25b53baad (diff) |
Add specs for attachment attributes.
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/mail_handler/mail_handler_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index c01b173d5..ae65210f2 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -275,6 +275,26 @@ end describe 'when getting attachment attributes' do + it 'should get two attachment parts from a multipart mail with text and html alternatives + and an image' do + mail = get_fixture_mail('quoted-subject-iso8859-1.email') + attributes = MailHandler.get_attachment_attributes(mail) + attributes.size.should == 2 + end + + it 'should expand a mail attached as text' do + mail = get_fixture_mail('rfc822-attachment.email') + attributes = MailHandler.get_attachment_attributes(mail) + attributes.size.should == 2 + rfc_attachment = attributes[1] + rfc_attachment[:within_rfc822_subject].should == 'Freedom of Information request' + headers = ['Date: Thu, 13 Mar 2008 16:57:33 +0000', + 'Subject: Freedom of Information request', + 'From: An FOI Officer <foi.officer@example.com>', + 'To: request-bounce-xx-xxxxx@whatdotheyno.com'] + rfc_attachment[:body].should == "#{headers.join("\n")}\n\nsome example text" + end + it 'should handle a mail which causes Tmail to generate a blank header value' do mail = get_fixture_mail('many-attachments-date-header.email') attributes = MailHandler.get_attachment_attributes(mail) |