aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/incoming_message.rb8
-rw-r--r--lib/mail_handler/backends/tmail_backend.rb9
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb16
3 files changed, 25 insertions, 8 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 5205d0a2d..d19b258a7 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -38,14 +38,6 @@ require 'zip/zip'
require 'mapi/msg'
require 'mapi/convert'
-# Monkeypatch! Adding some extra members to store extra info in.
-module TMail
- class Mail
- attr_accessor :url_part_number
- attr_accessor :rfc822_attachment # when a whole email message is attached as text
- attr_accessor :within_rfc822_attachment # for parts within a message attached as text (for getting subject mainly)
- end
-end
class IncomingMessage < ActiveRecord::Base
belongs_to :info_request
diff --git a/lib/mail_handler/backends/tmail_backend.rb b/lib/mail_handler/backends/tmail_backend.rb
index b2d36d65f..e5bfa3f49 100644
--- a/lib/mail_handler/backends/tmail_backend.rb
+++ b/lib/mail_handler/backends/tmail_backend.rb
@@ -1,3 +1,12 @@
+# Monkeypatch! Adding some extra members to store extra info in.
+module TMail
+ class Mail
+ attr_accessor :url_part_number
+ attr_accessor :rfc822_attachment # when a whole email message is attached as text
+ attr_accessor :within_rfc822_attachment # for parts within a message attached as text (for getting subject mainly)
+ end
+end
+
module MailHandler
module Backends
module TmailBackend
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