astrotrain 0.4.1 → 0.4.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{astrotrain}
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["technoweenie"]
@@ -91,7 +91,13 @@ module Astrotrain
91
91
  return {} if email.blank?
92
92
  begin
93
93
  header = TMail::Address.parse(email)
94
- {:name => header.name, :email => header.address}
94
+ parsed = {:name => header.name}
95
+ if header.is_a?(TMail::AddressGroup)
96
+ parsed[:email] = header[0].address
97
+ else
98
+ parsed[:email] = header.address
99
+ end
100
+ parsed
95
101
  rescue SyntaxError, TMail::SyntaxError
96
102
  email = email.scan(/\<([^\>]+)\>/)[0]
97
103
  if email.blank?
@@ -433,6 +433,14 @@ class Astrotrain::MessageTest < Astrotrain::TestCase
433
433
  assert_equal %w(processor-reply-57@custom.com processor-delivered@astrotrain.com processor@astrotrain.com), @message.recipients
434
434
  end
435
435
  end
436
+
437
+ it "parses invalid email collection" do
438
+ assert_equal %w(ricky@foo.com bobby@foo.com), Astrotrain::Message.parse_email_addresses("Ricky <ricky@foo.com>, Bobby:bobby@foo.com")
439
+ end
440
+
441
+ it "parses invalid email" do
442
+ assert_equal({:name => "Name", :email => "email@server.com"}, Astrotrain::Message.parse_email_address("Name:email@server.com"))
443
+ end
436
444
  end
437
445
 
438
446
  describe "queueing" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrotrain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - technoweenie