iron_mailer 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/iron_mailer.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_dependency "mail"
25
- spec.add_dependency "iron_mq", '~> 3.1'
26
- spec.add_dependency "iron_cache", '~> 1.3'
25
+ spec.add_dependency "iron_mq", '~> 4.0'
26
+ spec.add_dependency "iron_cache", '~> 1.4'
27
27
  spec.add_dependency "typhoeus"
28
28
  spec.add_dependency "uuidtools"
29
29
  end
@@ -32,7 +32,7 @@ class IronMailer::SendEmail
32
32
  def split_email(source_email)
33
33
  tos = source_email.to
34
34
  tos.uniq.map{|destination|
35
- duplicate = source_email.clone
35
+ duplicate = Mail.new(source_email)
36
36
  duplicate.to = destination
37
37
 
38
38
  if destination==tos.first
@@ -1,3 +1,3 @@
1
1
  module IronMailer
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -283,8 +283,23 @@ describe IronMailer::SendEmail do
283
283
 
284
284
  it "should include a cache_id in the smtp headers" do
285
285
  @email = @send_email.split_email(@test_email).first
286
- JSON.parse(@email.header['X-SMTPAPI'].first.value)['unique_args']['cache_key'].should_not be_blank
286
+ field=@email.header['X-SMTPAPI']
287
+ cache_key = JSON.parse(field.value)['unique_args']['cache_key']
288
+ cache_key.should match(/^\w{8}/)
287
289
  end
290
+
291
+ it "should create an email for each 'to'" do
292
+ emails=@send_email.split_email(@test_email)
293
+ emails.each do |email|
294
+ email.to.length.should == 1
295
+ end
296
+ (%w{someother@example.com to@example.com}-emails.map{|email| email.to.first}).should == []
297
+ end
298
+
299
+ it "should create only a single email if the same 'to' is included more than once" do
300
+ @send_email.split_email(test_email('to@example.com')).length.should == 1
301
+ end
302
+
288
303
  end
289
304
 
290
305
  def test_config
@@ -294,7 +309,9 @@ describe IronMailer::SendEmail do
294
309
  end
295
310
 
296
311
  def test_email(other_tos=[])
297
- to = (['to@example.com']<<other_tos)
312
+ other_tos = [other_tos] unless other_tos.is_a?(Array)
313
+
314
+ to = (['to@example.com']+other_tos)
298
315
 
299
316
  mail=Mail.new do
300
317
  to to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
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: 2013-08-08 00:00:00.000000000 Z
12
+ date: 2013-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '3.1'
85
+ version: '4.0'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '3.1'
93
+ version: '4.0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: iron_cache
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: '1.3'
101
+ version: '1.4'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: '1.3'
109
+ version: '1.4'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: typhoeus
112
112
  requirement: !ruby/object:Gem::Requirement