diff --git a/lib/email_reply_parser.rb b/lib/email_reply_parser.rb index 982eaec..acfbecc 100644 --- a/lib/email_reply_parser.rb +++ b/lib/email_reply_parser.rb @@ -133,7 +133,7 @@ def read(text) private EMPTY = "".freeze - SIGNATURE = '(?m)(--\s*$|__\s*$|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)' + SIGNATURE = '(?m)(--\s*$|__\s*$|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)|(.*:morF)' begin require 're2' diff --git a/test/email_reply_parser_test.rb b/test/email_reply_parser_test.rb index 6710838..2b16313 100644 --- a/test/email_reply_parser_test.rb +++ b/test/email_reply_parser_test.rb @@ -144,6 +144,11 @@ def test_parse_out_just_top_for_outlook_with_reply_directly_above_line assert_equal "Outlook with a reply directly above line", EmailReplyParser.parse_reply(body) end + def test_parse_out_just_top_for_outlook_with_no_line_below_reply + body = IO.read EMAIL_FIXTURE_PATH.join("email_2_3.txt").to_s + assert_equal "Outlook with no line below reply", EmailReplyParser.parse_reply(body) + end + def test_parse_out_sent_from_iPhone body = IO.read EMAIL_FIXTURE_PATH.join("email_iPhone.txt").to_s assert_equal "Here is another email", EmailReplyParser.parse_reply(body) diff --git a/test/emails/email_2_3.txt b/test/emails/email_2_3.txt new file mode 100644 index 0000000..3bbe7f8 --- /dev/null +++ b/test/emails/email_2_3.txt @@ -0,0 +1,8 @@ +Outlook with no line below reply + +From: CRM Comments [crm-comment@example.com] +Sent: Friday, 23 March 2012 5:08 p.m. +To: John S. Greene +Subject: [contact:106] John Greene + +I don't like putting lines above my signature!