adzap-ar_mailer 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ = 2.0.2
2
+
3
+ * Bugs fixed
4
+ * Email class reloading issue in development mode causing AR email class defaults to be lost when cached
5
+
1
6
  = 2.0.1
2
7
 
3
8
  * Added option to use smtp setting of :tls => false to disable TLS auto start in Ruby 1.8.7+
data/README.rdoc CHANGED
@@ -104,13 +104,13 @@ See <tt>ar_sendmail -h</tt> for full details.
104
104
  If you want to set the ActiveRecord model that emails will be stored in,
105
105
  see ActionMailer::Base.email_class=
106
106
 
107
- === A word on TLS
107
+ === A Word on TLS
108
108
 
109
- If you are using Ruby 1.8.7 or above TLS will be enabled automatically if your
109
+ If you are using Ruby >= 1.8.7, TLS will be enabled automatically if your
110
110
  SMTP server supports it. If you do not want it to automatically enabled then
111
111
  set the :tls option to false in your smtp_settings.
112
112
 
113
- If you on Ruby 1.8.6 or less then the TLS patch included in this plugin will
113
+ If you are on Ruby <= 1.8.6, then the TLS patch included in this plugin will
114
114
  be loaded, so you don't need another TLS plugin to add the capability. This
115
115
  patch allows you to explicit set if the server supports TLS by setting the
116
116
  :tls option to true in your smtp_settings.
@@ -16,10 +16,17 @@ end
16
16
  class ActionMailer::Base
17
17
 
18
18
  ##
19
- # Set the email class for deliveries.
19
+ # Set the email class for deliveries. Handle class reloading issues which prevents caching the email class.
20
20
  #
21
- cattr_accessor :email_class
22
- self.email_class = Email
21
+ @@email_class_name = 'Email'
22
+
23
+ def self.email_class=(klass)
24
+ @@email_class_name = klass.to_s
25
+ end
26
+
27
+ def self.email_class
28
+ @@email_class_name.constantize
29
+ end
23
30
 
24
31
  ##
25
32
  # Adds +mail+ to the Email table. Only the first From address for +mail+ is
@@ -46,7 +46,7 @@ class ActionMailer::ARSendmail
46
46
  ##
47
47
  # The version of ActionMailer::ARSendmail you are running.
48
48
 
49
- VERSION = '2.0.1'
49
+ VERSION = '2.0.2'
50
50
 
51
51
  ##
52
52
  # Maximum number of times authentication will be consecutively retried
@@ -2,7 +2,7 @@ require 'test/unit'
2
2
  require 'action_mailer'
3
3
  require 'action_mailer/ar_sendmail'
4
4
  require 'rubygems'
5
- require 'test/zentest_assertions'
5
+ require 'minitest/autorun'
6
6
  require 'mocha'
7
7
 
8
8
  class ActionMailer::ARSendmail
@@ -13,7 +13,7 @@ class ActionMailer::ARSendmail
13
13
  end
14
14
  end
15
15
 
16
- class TestARSendmail < Test::Unit::TestCase
16
+ class TestARSendmail < MiniTest::Unit::TestCase
17
17
 
18
18
  def setup
19
19
  ActionMailer::Base.reset
@@ -34,7 +34,7 @@ class TestARSendmail < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_class_create_migration
37
- out, = util_capture do
37
+ out, = capture_io do
38
38
  ActionMailer::ARSendmail.create_migration 'Mail'
39
39
  end
40
40
 
@@ -60,7 +60,7 @@ end
60
60
  end
61
61
 
62
62
  def test_class_create_model
63
- out, = util_capture do
63
+ out, = capture_io do
64
64
  ActionMailer::ARSendmail.create_model 'Mail'
65
65
  end
66
66
 
@@ -82,7 +82,7 @@ end
82
82
  last_attempt_time = Time.parse('Thu Aug 10 2006 11:40:05')
83
83
  last.last_send_attempt = last_attempt_time.to_i
84
84
 
85
- out, err = util_capture do
85
+ out, err = capture_io do
86
86
  ActionMailer::ARSendmail.mailq 'Email'
87
87
  end
88
88
 
@@ -106,7 +106,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
106
106
  end
107
107
 
108
108
  def test_class_mailq_empty
109
- out, err = util_capture do
109
+ out, err = capture_io do
110
110
  ActionMailer::ARSendmail.mailq 'Email'
111
111
  end
112
112
 
@@ -158,7 +158,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
158
158
 
159
159
  argv = %w[-c /nonexistent]
160
160
 
161
- out, err = util_capture do
161
+ out, err = capture_io do
162
162
  assert_raises SystemExit do
163
163
  ActionMailer::ARSendmail.process_args argv
164
164
  end
@@ -221,7 +221,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
221
221
 
222
222
  def test_class_parse_args_mailq
223
223
  options = ActionMailer::ARSendmail.process_args []
224
- deny_includes options, :MailQ
224
+ refute_includes options, :MailQ
225
225
 
226
226
  argv = %w[--mailq]
227
227
 
@@ -243,7 +243,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
243
243
 
244
244
  def test_class_parse_args_migration
245
245
  options = ActionMailer::ARSendmail.process_args []
246
- deny_includes options, :Migration
246
+ refute_includes options, :Migration
247
247
 
248
248
  argv = %w[--create-migration]
249
249
 
@@ -254,7 +254,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
254
254
 
255
255
  def test_class_parse_args_model
256
256
  options = ActionMailer::ARSendmail.process_args []
257
- deny_includes options, :Model
257
+ refute_includes options, :Model
258
258
 
259
259
  argv = %w[--create-model]
260
260
 
@@ -266,8 +266,8 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
266
266
  def test_class_parse_args_no_config_environment
267
267
  $".delete 'config/environment.rb'
268
268
 
269
- out, err = util_capture do
270
- assert_raise SystemExit do
269
+ out, err = capture_io do
270
+ assert_raises SystemExit do
271
271
  ActionMailer::ARSendmail.process_args []
272
272
  end
273
273
  end
@@ -279,7 +279,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
279
279
  def test_class_parse_args_no_config_environment_migrate
280
280
  $".delete 'config/environment.rb'
281
281
 
282
- out, err = util_capture do
282
+ out, err = capture_io do
283
283
  ActionMailer::ARSendmail.process_args %w[--create-migration]
284
284
  end
285
285
 
@@ -292,7 +292,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
292
292
  def test_class_parse_args_no_config_environment_model
293
293
  $".delete 'config/environment.rb'
294
294
 
295
- out, err = util_capture do
295
+ out, err = capture_io do
296
296
  ActionMailer::ARSendmail.process_args %w[--create-model]
297
297
  end
298
298
 
@@ -334,7 +334,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
334
334
  end
335
335
 
336
336
  def test_class_usage
337
- out, err = util_capture do
337
+ out, err = capture_io do
338
338
  assert_raises SystemExit do
339
339
  ActionMailer::ARSendmail.usage 'opts'
340
340
  end
@@ -343,7 +343,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
343
343
  assert_equal '', out
344
344
  assert_equal "opts\n", err
345
345
 
346
- out, err = util_capture do
346
+ out, err = capture_io do
347
347
  assert_raises SystemExit do
348
348
  ActionMailer::ARSendmail.usage 'opts', 'hi'
349
349
  end
@@ -360,7 +360,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
360
360
  e3 = Email.create :mail => 'body', :to => 'to', :from => 'from'
361
361
  e3.last_send_attempt = Time.now
362
362
 
363
- out, err = util_capture do
363
+ out, err = capture_io do
364
364
  @sm.cleanup
365
365
  end
366
366
 
@@ -378,7 +378,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
378
378
 
379
379
  @sm.max_age = 0
380
380
 
381
- out, err = util_capture do
381
+ out, err = capture_io do
382
382
  @sm.cleanup
383
383
  end
384
384
 
@@ -389,7 +389,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
389
389
  def test_deliver
390
390
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
391
391
 
392
- out, err = util_capture do
392
+ out, err = capture_io do
393
393
  @sm.deliver [email]
394
394
  end
395
395
 
@@ -419,7 +419,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
419
419
 
420
420
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
421
421
 
422
- out, err = util_capture do
422
+ out, err = capture_io do
423
423
  @sm.deliver [email]
424
424
  end
425
425
 
@@ -438,7 +438,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
438
438
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
439
439
  @sm.failed_auth_count = 1
440
440
 
441
- out, err = util_capture do @sm.deliver [email] end
441
+ out, err = capture_io do @sm.deliver [email] end
442
442
 
443
443
  assert_equal 0, @sm.failed_auth_count
444
444
  assert_equal 1, Net::SMTP.deliveries.length
@@ -453,8 +453,8 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
453
453
 
454
454
  @sm.failed_auth_count = 1
455
455
 
456
- out, err = util_capture do
457
- assert_raise Net::SMTPAuthenticationError do
456
+ out, err = capture_io do
457
+ assert_raises Net::SMTPAuthenticationError do
458
458
  @sm.deliver []
459
459
  end
460
460
  end
@@ -474,7 +474,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
474
474
 
475
475
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
476
476
 
477
- out, err = util_capture do
477
+ out, err = capture_io do
478
478
  @sm.deliver [email]
479
479
  end
480
480
 
@@ -498,7 +498,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
498
498
 
499
499
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
500
500
 
501
- out, err = util_capture do
501
+ out, err = capture_io do
502
502
  @sm.deliver [email]
503
503
  end
504
504
 
@@ -519,7 +519,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
519
519
 
520
520
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
521
521
 
522
- out, err = util_capture do
522
+ out, err = capture_io do
523
523
  @sm.deliver [email]
524
524
  end
525
525
 
@@ -543,7 +543,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
543
543
 
544
544
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
545
545
 
546
- out, err = util_capture do
546
+ out, err = capture_io do
547
547
  @sm.deliver [email]
548
548
  end
549
549
 
@@ -570,7 +570,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
570
570
  email1 = Email.create :mail => 'body', :to => 'to', :from => 'from'
571
571
  email2 = Email.create :mail => 'body', :to => 'to', :from => 'from'
572
572
 
573
- out, err = util_capture do
573
+ out, err = capture_io do
574
574
  @sm.deliver [email1, email2]
575
575
  end
576
576
 
@@ -594,7 +594,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
594
594
 
595
595
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
596
596
 
597
- out, err = util_capture do
597
+ out, err = capture_io do
598
598
  @sm.deliver [email]
599
599
  end
600
600
 
@@ -608,8 +608,8 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
608
608
  end
609
609
 
610
610
  def test_do_exit
611
- out, err = util_capture do
612
- assert_raise SystemExit do
611
+ out, err = capture_io do
612
+ assert_raises SystemExit do
613
613
  @sm.do_exit
614
614
  end
615
615
  end
@@ -619,7 +619,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
619
619
  end
620
620
 
621
621
  def test_log
622
- out, err = util_capture do
622
+ out, err = capture_io do
623
623
  @sm.log 'hi'
624
624
  end
625
625
 
@@ -642,7 +642,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
642
642
 
643
643
  found_emails = []
644
644
 
645
- out, err = util_capture do
645
+ out, err = capture_io do
646
646
  found_emails = @sm.find_emails
647
647
  end
648
648
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adzap-ar_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-12 00:00:00 -07:00
13
+ date: 2009-04-17 00:00:00 -07:00
14
14
  default_executable: ar_sendmail
15
15
  dependencies: []
16
16
 
@@ -66,7 +66,7 @@ requirements: []
66
66
  rubyforge_project: seattlerb
67
67
  rubygems_version: 1.2.0
68
68
  signing_key:
69
- specification_version: 2
69
+ specification_version: 3
70
70
  summary: A two-phase delivery agent for ActionMailer
71
71
  test_files:
72
72
  - test/test_armailer.rb