File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def initialize
5858
5959
6060 def visible_text
61- fragments . select { |f | !f . hidden? } . map { |f | f . to_s } . join ( "\n " )
61+ fragments . select { |f | !f . hidden? } . map { |f | f . to_s } . join ( "\n " ) . rstrip
6262 end
6363
6464 # Splits the given text into a list of Fragments. This is roughly done by
@@ -127,7 +127,7 @@ def scan_line(line)
127127 # Mark the current Fragment as a signature if the current line is empty
128128 # and the Fragment starts with a common signature indicator.
129129 if @fragment && line == EMPTY
130- if @fragment . lines . last =~ /[\- \_ ]$/
130+ if @fragment . lines . last =~ /[\- \_ ]\s * $/
131131 @fragment . signature = true
132132 finish_fragment
133133 end
Original file line number Diff line number Diff line change @@ -78,8 +78,13 @@ def test_does_not_modify_input_string
7878 end
7979
8080 def test_returns_only_the_visible_fragments_as_a_string
81- reply = email ( :email_1_2 )
82- assert_equal reply . fragments . select { |r | !r . hidden? } . map { |r | r . to_s } . join ( "\n " ) , reply . visible_text
81+ reply = email ( :email_2_1 )
82+ assert_equal reply . fragments . select { |r | !r . hidden? } . map { |r | r . to_s } . join ( "\n " ) . rstrip , reply . visible_text
83+ end
84+
85+ def test_parse_out_just_top_for_outlook_reply
86+ body = IO . read EMAIL_FIXTURE_PATH . join ( "email_2_1.txt" ) . to_s
87+ assert_equal "Outlook with a reply" , EmailReplyParser . parse_reply ( body )
8388 end
8489
8590 def test_parse_reply
Original file line number Diff line number Diff line change 1+ Outlook with a reply
2+
3+
4+ ------------------------------
5+
6+ *From:* Google Apps Sync Team [mailto:mail-noreply@google.com]
7+ *Sent:* Thursday, February 09, 2012 1:36 PM
8+ *To:* jow@xxxx.com
9+ *Subject:* Google Apps Sync was updated!
10+
11+
12+
13+ Dear Google Apps Sync user,
14+
15+ Google Apps Sync for Microsoft Outlook® was recently updated. Your computer
16+ now has the latest version (version 2.5). This release includes bug fixes
17+ to improve product reliability. For more information about these and other
18+ changes, please see the help article here:
19+
20+ http://www.google.com/support/a/bin/answer.py?answer=153463
21+
22+ Sincerely,
23+
24+ The Google Apps Sync Team.
25+
You can’t perform that action at this time.
0 commit comments