astrotrain 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/astrotrain.gemspec +1 -1
- data/lib/astrotrain/message.rb +7 -1
- data/test/message_test.rb +8 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/astrotrain.gemspec
CHANGED
data/lib/astrotrain/message.rb
CHANGED
@@ -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
|
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?
|
data/test/message_test.rb
CHANGED
@@ -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
|