Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sig parsing #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/email_reply_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions test/email_reply_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions test/emails/email_2_3.txt
Original file line number Diff line number Diff line change
@@ -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!