email_reply_parser 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d5b9fdfe30fe4feec4e1b84c68b25180b5da4cbe6aa8cebae7d7b725c6918c6
4
- data.tar.gz: e046ee4ce446ee8a54d2e669ae1cd10bc0ae7e5f9e55c28d439991f7c8311965
3
+ metadata.gz: 19456eb75469b983f8db4a0807f6691213264309223f37d02c7fcf44748e2d7c
4
+ data.tar.gz: 0a67068492fd8c2fe7221420e383f69f7ad0f6e7f435882830d8553e6f917bcf
5
5
  SHA512:
6
- metadata.gz: 1e4680771a08970cf019ad1bbeb7a2de56b34df351cca6a6a10aaeebff681eff71e4e2fce7809667ab9e5d1505506d5835d8e180dae731825c97a1ef3ae30cf8
7
- data.tar.gz: cef0b121c8c201116348fa880274191b1020ed189c11b0c49a8f13e5d00b619a40aeac8eafe1fb09e908e9ff179d3b47692212364192fe3d7adde33a2c6cfc5f
6
+ metadata.gz: e6b065c74ce3eec383d570824c3c22a0ff9fc1cbc17a99cbbac230a92a0eb9c90adcc96f6288891a676ff65da1a791d11b7c1a3cce9a22bacb3752c6fab6abf0
7
+ data.tar.gz: 72e65bff3a0850354268451e89ea352a8ab59c5bb8fe1c27ff7558df740ecd233915daaf5e35830a4c9c07617bc5ce6634a0c50aa5d3bd3464821c3328824e7e
@@ -54,9 +54,11 @@ Gem::Specification.new do |s|
54
54
  test/emails/email_1_8.txt
55
55
  test/emails/email_2_1.txt
56
56
  test/emails/email_2_2.txt
57
+ test/emails/email_2_3.txt
57
58
  test/emails/email_BlackBerry.txt
58
59
  test/emails/email_bullets.txt
59
60
  test/emails/email_iPhone.txt
61
+ test/emails/email_long_quote.txt
60
62
  test/emails/email_multi_word_sent_from_my_mobile_device.txt
61
63
  test/emails/email_one_is_not_on.txt
62
64
  test/emails/email_sent_from_my_not_signature.txt
@@ -30,7 +30,7 @@ require 'strscan'
30
30
  #
31
31
  # [mail]: https://github.com/mikel/mail
32
32
  class EmailReplyParser
33
- VERSION = "0.5.10"
33
+ VERSION = "0.5.11"
34
34
 
35
35
  # Public: Splits an email body into a list of Fragments.
36
36
  #
@@ -147,9 +147,9 @@ class EmailReplyParser
147
147
  line.chomp!("\n")
148
148
  line.lstrip! unless SIG_REGEX.match(line)
149
149
 
150
- # We're looking for leading `>`'s to see if this line is part of a
150
+ # We're looking for a leading `>` to see if this line is part of a
151
151
  # quoted Fragment.
152
- is_quoted = !!(line =~ /(>+)$/)
152
+ is_quoted = !!(line =~ /(>)$/)
153
153
 
154
154
  # Mark the current Fragment as a signature if the current line is empty
155
155
  # and the Fragment starts with a common signature indicator.
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'pathname'
4
4
  require 'pp'
5
+ require 'timeout'
5
6
 
6
7
  dir = Pathname.new File.expand_path(File.dirname(__FILE__))
7
8
  require dir + '..' + 'lib' + 'email_reply_parser'
@@ -222,6 +223,12 @@ I am currently using the Java HTTP API.\n", reply.fragments[0].to_s
222
223
  assert_equal 1, reply.fragments.size
223
224
  end
224
225
 
226
+ def test_long_quote_processing_completes
227
+ reply = Timeout.timeout(1) { email(:email_long_quote) }
228
+
229
+ assert_equal 5, reply.fragments.size
230
+ end
231
+
225
232
  def email(name)
226
233
  body = IO.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s
227
234
  EmailReplyParser.read body
@@ -0,0 +1,10 @@
1
+ Outlook with a reply directly above line
2
+
3
+ From: CRM Comments [crm-comment@example.com]
4
+ Sent: Friday, 23 March 2012 5:08 p.m.
5
+ To: John S. Greene
6
+ Subject: [contact:106] John Greene
7
+
8
+ > A new comment has been added to the Contact named 'John Greene':
9
+ >
10
+ > I am replying to a comment.