email_reply_parser 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ $LOAD_PATH.unshift '.'
2
+ require 'lib/email_reply_parser'
3
+
1
4
  ## This is the rakegem gemspec template. Make sure you read and understand
2
5
  ## all of the comments. Some sections require modification, and others can
3
6
  ## be deleted if you don't need them. Once you understand the contents of
@@ -13,8 +16,8 @@ Gem::Specification.new do |s|
13
16
  ## If your rubyforge_project name is different, then edit it and comment out
14
17
  ## the sub! line in the Rakefile
15
18
  s.name = 'email_reply_parser'
16
- s.version = '0.5.2'
17
- s.date = '2012-09-27'
19
+ s.version = EmailReplyParser::VERSION
20
+ s.date = Time.now.strftime('%Y-%m-%d')
18
21
  s.rubyforge_project = 'email_reply_parser'
19
22
 
20
23
  ## Make sure your summary is short. The description may be as long
@@ -30,7 +30,7 @@ require 'strscan'
30
30
  #
31
31
  # [mail]: https://github.com/mikel/mail
32
32
  class EmailReplyParser
33
- VERSION = "0.5.1"
33
+ VERSION = "0.5.3"
34
34
 
35
35
  # Public: Splits an email body into a list of Fragments.
36
36
  #
@@ -84,7 +84,7 @@ class EmailReplyParser
84
84
 
85
85
  # Check for multi-line reply headers. Some clients break up
86
86
  # the "On DATE, NAME <EMAIL> wrote:" line into multiple lines.
87
- if text =~ /^(On(.+)wrote:)$/nm
87
+ if text =~ /^(On\s(.+)wrote:)$/nm
88
88
  # Remove all new lines from the reply header.
89
89
  text.gsub! $1, $1.gsub("\n", " ")
90
90
  end
@@ -79,7 +79,7 @@ I am currently using the Java HTTP API.\n", reply.fragments[0].to_s
79
79
 
80
80
  def test_reads_email_with_correct_signature
81
81
  reply = email :correct_sig
82
-
82
+
83
83
  assert_equal 2, reply.fragments.size
84
84
  assert_equal [false, false], reply.fragments.map { |f| f.quoted? }
85
85
  assert_equal [false, true], reply.fragments.map { |f| f.signature? }
@@ -141,15 +141,21 @@ I am currently using the Java HTTP API.\n", reply.fragments[0].to_s
141
141
 
142
142
  def test_retains_bullets
143
143
  body = IO.read EMAIL_FIXTURE_PATH.join("email_bullets.txt").to_s
144
- assert_equal "test 2 this should list second\n\nand have spaces\n\nand retain this formatting\n\n\n - how about bullets\n - and another",
144
+ assert_equal "test 2 this should list second\n\nand have spaces\n\nand retain this formatting\n\n\n - how about bullets\n - and another",
145
145
  EmailReplyParser.parse_reply(body)
146
- end
146
+ end
147
147
 
148
148
  def test_parse_reply
149
149
  body = IO.read EMAIL_FIXTURE_PATH.join("email_1_2.txt").to_s
150
150
  assert_equal EmailReplyParser.read(body).visible_text, EmailReplyParser.parse_reply(body)
151
151
  end
152
152
 
153
+ def test_one_is_not_on
154
+ reply = email("email_one_is_not_on")
155
+ assert_match /One outstanding question/, reply.fragments[0].to_s
156
+ assert_match /^On Oct 1, 2012/, reply.fragments[1].to_s
157
+ end
158
+
153
159
  def email(name)
154
160
  body = IO.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s
155
161
  EmailReplyParser.read body
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_reply_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-27 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Long description. Maybe copied from the README.
15
15
  email: technoweenie@gmail.com