ar_mailer 1.3.1 → 1.3.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.
@@ -0,0 +1,2 @@
1
+ mC�� ��|���G�T��8����}\�����WL�/�C�<�n�ٛ��:����S��mr�S���7/E���t��&� �O<��Mœ�ž�
2
+ $k~⚲��l��� �]_j��pl���R��C�e���i%�*m)�@�ySs��Ge���+�Da^�eX0� �י� ����Xγ�bʓ�-�^��u����Q�106�,z���q�����
@@ -1,3 +1,12 @@
1
+ = 1.3.2
2
+
3
+ * Terminate SMTP connection on TimeoutError since Net::SMTP may be in a bogus
4
+ state. Issue by Eric O'Connell.
5
+ * Don't require Email class to exist. Bug #22843 by Joachim Glauche.
6
+ * Switched to minitest
7
+ * Upgraded to modern Hoe
8
+ * Updated configuration information for Rails > 2.0
9
+
1
10
  = 1.3.1
2
11
 
3
12
  * Fix bug #12530, gmail causes SSL errors. Submitted by Kyle Maxwell
data/README.txt CHANGED
@@ -1,39 +1,28 @@
1
1
  = ar_mailer
2
2
 
3
- A two-phase delivery agent for ActionMailer
3
+ * http://seattlerb.rubyforge.org/ar_mailer
4
+ * http://rubyforge.org/projects/seattlerb
5
+ * http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921
4
6
 
5
- Rubyforge Project:
7
+ == DESCRIPTION:
6
8
 
7
- http://rubyforge.org/projects/seattlerb
9
+ ar_mailer is a two-phase delivery agent for ActionMailer. Even delivering
10
+ email to the local machine may take too long when you have to send hundreds of
11
+ messages. ar_mailer allows you to store messages into the database for later
12
+ delivery by a separate process, ar_sendmail.
8
13
 
9
- Documentation:
14
+ == SYNOPSIS:
10
15
 
11
- http://seattlerb.org/ar_mailer
16
+ See ActionMailer::ARMailer for instructions on using ar_mailer.
12
17
 
13
- Bugs:
14
-
15
- http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921
16
-
17
- == About
18
-
19
- Even delivering email to the local machine may take too long when you have to
20
- send hundreds of messages. ar_mailer allows you to store messages into the
21
- database for later delivery by a separate process, ar_sendmail.
22
-
23
- == Installing ar_mailer
24
-
25
- Just install the gem:
18
+ See ar_sendmail -h for options to ar_sendmail.
26
19
 
27
- $ sudo gem install ar_mailer
20
+ An rc.d script is included in share/ar_sendmail for *BSD operating systems.
28
21
 
29
- See ActionMailer::ARMailer for instructions on converting to ARMailer.
22
+ == INSTALL:
30
23
 
31
- See ar_sendmail -h for options to ar_sendmail.
24
+ * gem install ar_mailer
32
25
 
33
26
  NOTE: You may need to delete an smtp_tls.rb file if you have one lying
34
27
  around. ar_mailer supplies it own.
35
28
 
36
- === ar_sendmail on FreeBSD or NetBSD
37
-
38
- An rc.d script is included in share/ar_sendmail.
39
-
data/Rakefile CHANGED
@@ -1,14 +1,12 @@
1
1
  require 'hoe'
2
2
 
3
- require './lib/action_mailer/ar_sendmail'
3
+ $:.unshift 'lib'
4
+ require 'action_mailer/ar_sendmail'
4
5
 
5
- Hoe.new 'ar_mailer', ActionMailer::ARSendmail::VERSION do |s|
6
- s.rubyforge_name = 'seattlerb'
7
- s.summary = s.paragraphs_of('README.txt', 1).join(' ')
8
- s.description = s.paragraphs_of('README.txt', 9).join(' ')
9
- s.url = s.paragraphs_of('README.txt', 5).join(' ')
10
- s.author = 'Eric Hodel'
11
- s.email = 'drbrain@segment7.net'
12
- s.changes = s.paragraphs_of('History.txt', 0..1).join("\n\n")
6
+ Hoe.new 'ar_mailer', ActionMailer::ARSendmail::VERSION do |ar_mailer|
7
+ ar_mailer.rubyforge_name = 'seattlerb'
8
+ ar_mailer.developer 'Eric Hodel', 'drbrain@segment7.net'
9
+ ar_mailer.testlib = :minitest
10
+ ar_mailer.extra_dev_deps << ['minitest', '~> 1.3']
13
11
  end
14
12
 
File without changes
@@ -50,6 +50,11 @@ require 'action_mailer'
50
50
  # Edit config/environments/production.rb and set the delivery agent:
51
51
  #
52
52
  # $ grep delivery_method config/environments/production.rb
53
+ # config.action_mailer.delivery_method = :activerecord
54
+ #
55
+ # For Rails 1.x and older:
56
+ #
57
+ # $ grep delivery_method config/environments/production.rb
53
58
  # ActionMailer::Base.delivery_method = :activerecord
54
59
  #
55
60
  # Run ar_sendmail:
@@ -67,20 +72,20 @@ require 'action_mailer'
67
72
 
68
73
  class ActionMailer::ARMailer < ActionMailer::Base
69
74
 
70
- @@email_class = Email
75
+ @email_class = nil
71
76
 
72
77
  ##
73
78
  # Current email class for deliveries.
74
79
 
75
80
  def self.email_class
76
- @@email_class
81
+ @email_class ||= Email
77
82
  end
78
83
 
79
84
  ##
80
85
  # Sets the email class for deliveries.
81
86
 
82
87
  def self.email_class=(klass)
83
- @@email_class = klass
88
+ @email_class = klass
84
89
  end
85
90
 
86
91
  ##
@@ -88,9 +93,11 @@ class ActionMailer::ARMailer < ActionMailer::Base
88
93
  # used.
89
94
 
90
95
  def perform_delivery_activerecord(mail)
96
+ email_class = ActionMailer::ARMailer.email_class
97
+
91
98
  mail.destinations.each do |destination|
92
- @@email_class.create :mail => mail.encoded, :to => destination,
93
- :from => mail.from.first
99
+ email_class.create :mail => mail.encoded, :to => destination,
100
+ :from => mail.from.first
94
101
  end
95
102
  end
96
103
 
@@ -54,7 +54,7 @@ class ActionMailer::ARSendmail
54
54
  ##
55
55
  # The version of ActionMailer::ARSendmail you are running.
56
56
 
57
- VERSION = '1.3.1'
57
+ VERSION = '1.3.2'
58
58
 
59
59
  ##
60
60
  # Maximum number of times authentication will be consecutively retried
@@ -432,6 +432,9 @@ end
432
432
  email.save rescue nil
433
433
  log "error sending email %d: %p(%s):\n\t%s" %
434
434
  [email.id, e.message, e.class, e.backtrace.join("\n\t")]
435
+
436
+ raise e if TimeoutError === e
437
+
435
438
  smtp.reset
436
439
  end
437
440
  end
@@ -447,6 +450,9 @@ end
447
450
  sleep delay
448
451
  rescue Net::SMTPServerBusy, SystemCallError, OpenSSL::SSL::SSLError
449
452
  # ignore SMTPServerBusy/EPIPE/ECONNRESET from Net::SMTP.start's ensure
453
+ rescue TimeoutError
454
+ # terminate our connection since Net::SMTP may be in a bogus state.
455
+ sleep delay
450
456
  end
451
457
 
452
458
  ##
File without changes
@@ -1,6 +1,7 @@
1
- require 'test/unit'
2
1
  require 'action_mailer'
3
2
  require 'action_mailer/ar_mailer'
3
+ require 'rubygems'
4
+ require 'minitest/autorun'
4
5
 
5
6
  ##
6
7
  # Pretend mailer
@@ -16,7 +17,7 @@ class Mailer < ActionMailer::ARMailer
16
17
 
17
18
  end
18
19
 
19
- class TestARMailer < Test::Unit::TestCase
20
+ class TestARMailer < MiniTest::Unit::TestCase
20
21
 
21
22
  def setup
22
23
  Mailer.email_class = Email
@@ -1,8 +1,7 @@
1
- require 'test/unit'
2
1
  require 'action_mailer'
3
2
  require 'action_mailer/ar_sendmail'
4
3
  require 'rubygems'
5
- require 'test/zentest_assertions'
4
+ require 'minitest/autorun'
6
5
 
7
6
  class ActionMailer::ARSendmail
8
7
  attr_accessor :slept
@@ -12,7 +11,7 @@ class ActionMailer::ARSendmail
12
11
  end
13
12
  end
14
13
 
15
- class TestARSendmail < Test::Unit::TestCase
14
+ class TestARSendmail < MiniTest::Unit::TestCase
16
15
 
17
16
  def setup
18
17
  ActionMailer::Base.reset
@@ -31,7 +30,7 @@ class TestARSendmail < Test::Unit::TestCase
31
30
  end
32
31
 
33
32
  def test_class_create_migration
34
- out, = util_capture do
33
+ out, = capture_io do
35
34
  ActionMailer::ARSendmail.create_migration 'Mail'
36
35
  end
37
36
 
@@ -53,11 +52,11 @@ class AddMail < ActiveRecord::Migration
53
52
  end
54
53
  EOF
55
54
 
56
- assert_equal expected, out.string
55
+ assert_equal expected, out
57
56
  end
58
57
 
59
58
  def test_class_create_model
60
- out, = util_capture do
59
+ out, = capture_io do
61
60
  ActionMailer::ARSendmail.create_model 'Mail'
62
61
  end
63
62
 
@@ -66,7 +65,7 @@ class Mail < ActiveRecord::Base
66
65
  end
67
66
  EOF
68
67
 
69
- assert_equal expected, out.string
68
+ assert_equal expected, out
70
69
  end
71
70
 
72
71
  def test_class_mailq
@@ -79,7 +78,7 @@ end
79
78
 
80
79
  last.last_send_attempt = Time.parse('Thu Aug 10 2006 11:40:05').to_i
81
80
 
82
- out, err = util_capture do
81
+ out, err = capture_io do
83
82
  ActionMailer::ARSendmail.mailq 'Email'
84
83
  end
85
84
 
@@ -98,15 +97,15 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
98
97
  -- 0 Kbytes in 3 Requests.
99
98
  EOF
100
99
 
101
- assert_equal expected, out.string
100
+ assert_equal expected, out
102
101
  end
103
102
 
104
103
  def test_class_mailq_empty
105
- out, err = util_capture do
104
+ out, err = capture_io do
106
105
  ActionMailer::ARSendmail.mailq 'Email'
107
106
  end
108
107
 
109
- assert_equal "Mail queue is empty\n", out.string
108
+ assert_equal "Mail queue is empty\n", out
110
109
  end
111
110
 
112
111
  def test_class_new
@@ -141,20 +140,20 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
141
140
 
142
141
  def test_class_parse_args_chdir
143
142
  argv = %w[-c /tmp]
144
-
143
+
145
144
  options = ActionMailer::ARSendmail.process_args argv
146
145
 
147
146
  assert_equal '/tmp', options[:Chdir]
148
147
 
149
148
  argv = %w[--chdir /tmp]
150
-
149
+
151
150
  options = ActionMailer::ARSendmail.process_args argv
152
151
 
153
152
  assert_equal '/tmp', options[:Chdir]
154
153
 
155
154
  argv = %w[-c /nonexistent]
156
-
157
- out, err = util_capture do
155
+
156
+ out, err = capture_io do
158
157
  assert_raises SystemExit do
159
158
  ActionMailer::ARSendmail.process_args argv
160
159
  end
@@ -163,13 +162,13 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
163
162
 
164
163
  def test_class_parse_args_daemon
165
164
  argv = %w[-d]
166
-
165
+
167
166
  options = ActionMailer::ARSendmail.process_args argv
168
167
 
169
168
  assert_equal true, options[:Daemon]
170
169
 
171
170
  argv = %w[--daemon]
172
-
171
+
173
172
  options = ActionMailer::ARSendmail.process_args argv
174
173
 
175
174
  assert_equal true, options[:Daemon]
@@ -177,7 +176,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
177
176
 
178
177
  def test_class_parse_args_delay
179
178
  argv = %w[--delay 75]
180
-
179
+
181
180
  options = ActionMailer::ARSendmail.process_args argv
182
181
 
183
182
  assert_equal 75, options[:Delay]
@@ -187,7 +186,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
187
186
  assert_equal nil, ENV['RAILS_ENV']
188
187
 
189
188
  argv = %w[-e production]
190
-
189
+
191
190
  options = ActionMailer::ARSendmail.process_args argv
192
191
 
193
192
  assert_equal 'production', options[:RailsEnv]
@@ -195,7 +194,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
195
194
  assert_equal 'production', ENV['RAILS_ENV']
196
195
 
197
196
  argv = %w[--environment production]
198
-
197
+
199
198
  options = ActionMailer::ARSendmail.process_args argv
200
199
 
201
200
  assert_equal 'production', options[:RailsEnv]
@@ -203,10 +202,10 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
203
202
 
204
203
  def test_class_parse_args_mailq
205
204
  options = ActionMailer::ARSendmail.process_args []
206
- deny_includes :MailQ, options
205
+ refute_includes options, :MailQ
207
206
 
208
207
  argv = %w[--mailq]
209
-
208
+
210
209
  options = ActionMailer::ARSendmail.process_args argv
211
210
 
212
211
  assert_equal true, options[:MailQ]
@@ -225,10 +224,10 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
225
224
 
226
225
  def test_class_parse_args_migration
227
226
  options = ActionMailer::ARSendmail.process_args []
228
- deny_includes :Migration, options
227
+ refute_includes options, :Migration
229
228
 
230
229
  argv = %w[--create-migration]
231
-
230
+
232
231
  options = ActionMailer::ARSendmail.process_args argv
233
232
 
234
233
  assert_equal true, options[:Migrate]
@@ -236,10 +235,10 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
236
235
 
237
236
  def test_class_parse_args_model
238
237
  options = ActionMailer::ARSendmail.process_args []
239
- deny_includes :Model, options
238
+ refute_includes options, :Model
240
239
 
241
240
  argv = %w[--create-model]
242
-
241
+
243
242
  options = ActionMailer::ARSendmail.process_args argv
244
243
 
245
244
  assert_equal true, options[:Model]
@@ -248,8 +247,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
248
247
  def test_class_parse_args_no_config_environment
249
248
  $".delete 'config/environment.rb'
250
249
 
251
- out, err = util_capture do
252
- assert_raise SystemExit do
250
+ out, err = capture_io do
251
+ assert_raises SystemExit do
253
252
  ActionMailer::ARSendmail.process_args []
254
253
  end
255
254
  end
@@ -261,7 +260,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
261
260
  def test_class_parse_args_no_config_environment_migrate
262
261
  $".delete 'config/environment.rb'
263
262
 
264
- out, err = util_capture do
263
+ out, err = capture_io do
265
264
  ActionMailer::ARSendmail.process_args %w[--create-migration]
266
265
  end
267
266
 
@@ -274,7 +273,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
274
273
  def test_class_parse_args_no_config_environment_model
275
274
  $".delete 'config/environment.rb'
276
275
 
277
- out, err = util_capture do
276
+ out, err = capture_io do
278
277
  ActionMailer::ARSendmail.process_args %w[--create-model]
279
278
  end
280
279
 
@@ -289,13 +288,13 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
289
288
 
290
289
  def test_class_parse_args_once
291
290
  argv = %w[-o]
292
-
291
+
293
292
  options = ActionMailer::ARSendmail.process_args argv
294
293
 
295
294
  assert_equal true, options[:Once]
296
295
 
297
296
  argv = %w[--once]
298
-
297
+
299
298
  options = ActionMailer::ARSendmail.process_args argv
300
299
 
301
300
  assert_equal true, options[:Once]
@@ -303,36 +302,36 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
303
302
 
304
303
  def test_class_parse_args_table_name
305
304
  argv = %w[-t Email]
306
-
305
+
307
306
  options = ActionMailer::ARSendmail.process_args argv
308
307
 
309
308
  assert_equal 'Email', options[:TableName]
310
309
 
311
310
  argv = %w[--table-name=Email]
312
-
311
+
313
312
  options = ActionMailer::ARSendmail.process_args argv
314
313
 
315
314
  assert_equal 'Email', options[:TableName]
316
315
  end
317
316
 
318
317
  def test_class_usage
319
- out, err = util_capture do
318
+ out, err = capture_io do
320
319
  assert_raises SystemExit do
321
320
  ActionMailer::ARSendmail.usage 'opts'
322
321
  end
323
322
  end
324
323
 
325
- assert_equal '', out.string
326
- assert_equal "opts\n", err.string
324
+ assert_equal '', out
325
+ assert_equal "opts\n", err
327
326
 
328
- out, err = util_capture do
327
+ out, err = capture_io do
329
328
  assert_raises SystemExit do
330
329
  ActionMailer::ARSendmail.usage 'opts', 'hi'
331
330
  end
332
331
  end
333
332
 
334
- assert_equal '', out.string
335
- assert_equal "hi\n\nopts\n", err.string
333
+ assert_equal '', out
334
+ assert_equal "hi\n\nopts\n", err
336
335
  end
337
336
 
338
337
  def test_cleanup
@@ -342,12 +341,12 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
342
341
  e3 = Email.create :mail => 'body', :to => 'to', :from => 'from'
343
342
  e3.last_send_attempt = Time.now
344
343
 
345
- out, err = util_capture do
344
+ out, err = capture_io do
346
345
  @sm.cleanup
347
346
  end
348
347
 
349
- assert_equal '', out.string
350
- assert_equal "expired 1 emails from the queue\n", err.string
348
+ assert_equal '', out
349
+ assert_equal "expired 1 emails from the queue\n", err
351
350
  assert_equal 2, Email.records.length
352
351
 
353
352
  assert_equal [e1, e2], Email.records
@@ -360,18 +359,18 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
360
359
 
361
360
  @sm.max_age = 0
362
361
 
363
- out, err = util_capture do
362
+ out, err = capture_io do
364
363
  @sm.cleanup
365
364
  end
366
365
 
367
- assert_equal '', out.string
366
+ assert_equal '', out
368
367
  assert_equal 2, Email.records.length
369
368
  end
370
369
 
371
370
  def test_deliver
372
371
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
373
372
 
374
- out, err = util_capture do
373
+ out, err = capture_io do
375
374
  @sm.deliver [email]
376
375
  end
377
376
 
@@ -380,8 +379,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
380
379
  assert_equal 0, Email.records.length
381
380
  assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
382
381
 
383
- assert_equal '', out.string
384
- assert_equal "sent email 00000000001 from from to to: \"queued\"\n", err.string
382
+ assert_equal '', out
383
+ assert_equal "sent email 00000000001 from from to to: \"queued\"\n", err
385
384
  end
386
385
 
387
386
  def test_deliver_auth_error
@@ -395,7 +394,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
395
394
 
396
395
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
397
396
 
398
- out, err = util_capture do
397
+ out, err = capture_io do
399
398
  @sm.deliver [email]
400
399
  end
401
400
 
@@ -406,15 +405,15 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
406
405
  assert_equal 1, @sm.failed_auth_count
407
406
  assert_equal [60], @sm.slept
408
407
 
409
- assert_equal '', out.string
410
- assert_equal "authentication error, retrying: try again\n", err.string
408
+ assert_equal '', out
409
+ assert_equal "authentication error, retrying: try again\n", err
411
410
  end
412
411
 
413
412
  def test_deliver_auth_error_recover
414
413
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
415
414
  @sm.failed_auth_count = 1
416
415
 
417
- out, err = util_capture do @sm.deliver [email] end
416
+ out, err = capture_io do @sm.deliver [email] end
418
417
 
419
418
  assert_equal 0, @sm.failed_auth_count
420
419
  assert_equal 1, Net::SMTP.deliveries.length
@@ -429,14 +428,14 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
429
428
 
430
429
  @sm.failed_auth_count = 1
431
430
 
432
- out, err = util_capture do
433
- assert_raise Net::SMTPAuthenticationError do
431
+ out, err = capture_io do
432
+ assert_raises Net::SMTPAuthenticationError do
434
433
  @sm.deliver []
435
434
  end
436
435
  end
437
436
 
438
437
  assert_equal 2, @sm.failed_auth_count
439
- assert_equal "authentication error, giving up: try again\n", err.string
438
+ assert_equal "authentication error, giving up: try again\n", err
440
439
  end
441
440
 
442
441
  def test_deliver_4xx_error
@@ -450,7 +449,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
450
449
 
451
450
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
452
451
 
453
- out, err = util_capture do
452
+ out, err = capture_io do
454
453
  @sm.deliver [email]
455
454
  end
456
455
 
@@ -459,8 +458,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
459
458
  assert_operator now, :<=, Email.records.first.last_send_attempt
460
459
  assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
461
460
 
462
- assert_equal '', out.string
463
- assert_equal "error sending email 1: \"try again\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\n", err.string
461
+ assert_equal '', out
462
+ assert_equal "error sending email 1: \"try again\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\n", err
464
463
  end
465
464
 
466
465
  def test_deliver_5xx_error
@@ -474,7 +473,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
474
473
 
475
474
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
476
475
 
477
- out, err = util_capture do
476
+ out, err = capture_io do
478
477
  @sm.deliver [email]
479
478
  end
480
479
 
@@ -482,8 +481,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
482
481
  assert_equal 0, Email.records.length
483
482
  assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
484
483
 
485
- assert_equal '', out.string
486
- assert_equal "5xx error sending email 1, removing from queue: \"unknown recipient\"(Net::SMTPFatalError):\n\tone\n\ttwo\n\tthree\n", err.string
484
+ assert_equal '', out
485
+ assert_equal "5xx error sending email 1, removing from queue: \"unknown recipient\"(Net::SMTPFatalError):\n\tone\n\ttwo\n\tthree\n", err
487
486
  end
488
487
 
489
488
  def test_deliver_errno_epipe
@@ -495,7 +494,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
495
494
 
496
495
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
497
496
 
498
- out, err = util_capture do
497
+ out, err = capture_io do
499
498
  @sm.deliver [email]
500
499
  end
501
500
 
@@ -504,8 +503,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
504
503
  assert_operator now, :>=, Email.records.first.last_send_attempt
505
504
  assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
506
505
 
507
- assert_equal '', out.string
508
- assert_equal '', err.string
506
+ assert_equal '', out
507
+ assert_equal '', err
509
508
  end
510
509
 
511
510
  def test_deliver_server_busy
@@ -519,7 +518,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
519
518
 
520
519
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
521
520
 
522
- out, err = util_capture do
521
+ out, err = capture_io do
523
522
  @sm.deliver [email]
524
523
  end
525
524
 
@@ -529,8 +528,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
529
528
  assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
530
529
  assert_equal [60], @sm.slept
531
530
 
532
- assert_equal '', out.string
533
- assert_equal "server too busy, sleeping 60 seconds\n", err.string
531
+ assert_equal '', out
532
+ assert_equal "server too busy, sleeping 60 seconds\n", err
534
533
  end
535
534
 
536
535
  def test_deliver_syntax_error
@@ -546,7 +545,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
546
545
  email1 = Email.create :mail => 'body', :to => 'to', :from => 'from'
547
546
  email2 = Email.create :mail => 'body', :to => 'to', :from => 'from'
548
547
 
549
- out, err = util_capture do
548
+ out, err = capture_io do
550
549
  @sm.deliver [email1, email2]
551
550
  end
552
551
 
@@ -555,8 +554,8 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
555
554
  assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
556
555
  assert_operator now, :<=, Email.records.first.last_send_attempt
557
556
 
558
- assert_equal '', out.string
559
- assert_equal "error sending email 1: \"blah blah blah\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\nsent email 00000000002 from from to to: \"queued\"\n", err.string
557
+ assert_equal '', out
558
+ assert_equal "error sending email 1: \"blah blah blah\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\nsent email 00000000002 from from to to: \"queued\"\n", err
560
559
  end
561
560
 
562
561
  def test_deliver_timeout
@@ -570,36 +569,36 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
570
569
 
571
570
  email = Email.create :mail => 'body', :to => 'to', :from => 'from'
572
571
 
573
- out, err = util_capture do
572
+ out, err = capture_io do
574
573
  @sm.deliver [email]
575
574
  end
576
575
 
577
576
  assert_equal 0, Net::SMTP.deliveries.length
578
577
  assert_equal 1, Email.records.length
579
578
  assert_operator now, :>=, Email.records.first.last_send_attempt
580
- assert_equal 1, Net::SMTP.reset_called, 'Reset connection on Timeout'
579
+ assert_equal 0, Net::SMTP.reset_called, 'SMTP terminated on Timeout'
581
580
 
582
- assert_equal '', out.string
583
- assert_equal "error sending email 1: \"timed out\"(Timeout::Error):\n\tone\n\ttwo\n\tthree\n", err.string
581
+ assert_equal '', out
582
+ assert_equal "error sending email 1: \"timed out\"(Timeout::Error):\n\tone\n\ttwo\n\tthree\n", err
584
583
  end
585
584
 
586
585
  def test_do_exit
587
- out, err = util_capture do
588
- assert_raise SystemExit do
586
+ out, err = capture_io do
587
+ assert_raises SystemExit do
589
588
  @sm.do_exit
590
589
  end
591
590
  end
592
591
 
593
- assert_equal '', out.string
594
- assert_equal "caught signal, shutting down\n", err.string
592
+ assert_equal '', out
593
+ assert_equal "caught signal, shutting down\n", err
595
594
  end
596
595
 
597
596
  def test_log
598
- out, err = util_capture do
597
+ out, err = capture_io do
599
598
  @sm.log 'hi'
600
599
  end
601
600
 
602
- assert_equal "hi\n", err.string
601
+ assert_equal "hi\n", err
603
602
  end
604
603
 
605
604
  def test_find_emails
@@ -618,14 +617,14 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
618
617
 
619
618
  found_emails = []
620
619
 
621
- out, err = util_capture do
620
+ out, err = capture_io do
622
621
  found_emails = @sm.find_emails
623
622
  end
624
623
 
625
624
  assert_equal emails, found_emails
626
625
 
627
- assert_equal '', out.string
628
- assert_equal "found 3 emails to send\n", err.string
626
+ assert_equal '', out
627
+ assert_equal "found 3 emails to send\n", err
629
628
  end
630
629
 
631
630
  def test_smtp_settings
metadata CHANGED
@@ -1,39 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4.3
3
- specification_version: 1
4
2
  name: ar_mailer
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.3.1
7
- date: 2007-07-31 00:00:00 -07:00
8
- summary: A two-phase delivery agent for ActionMailer
9
- require_paths:
10
- - lib
11
- email: drbrain@segment7.net
12
- homepage: http://seattlerb.org/ar_mailer
13
- rubyforge_project: seattlerb
14
- description: Even delivering email to the local machine may take too long when you have to send hundreds of messages. ar_mailer allows you to store messages into the database for later delivery by a separate process, ar_sendmail.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- required_rubygems_version: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">"
28
- - !ruby/object:Gem::Version
29
- version: 0.0.0
30
- version:
4
+ version: 1.3.2
31
5
  platform: ruby
32
- signing_key:
33
- cert_chain:
34
- post_install_message:
35
6
  authors:
36
7
  - Eric Hodel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
14
+ YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
+ ZXQwHhcNMDcxMjIxMDIwNDE0WhcNMDgxMjIwMDIwNDE0WjBBMRAwDgYDVQQDDAdk
16
+ cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
17
+ FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
18
+ LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
19
+ U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
20
+ Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
21
+ mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
22
+ g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
23
+ sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQUFAAOCAQEAHagT4lfX
25
+ kP/hDaiwGct7XPuVGbrOsKRVD59FF5kETBxEc9UQ1clKWngf8JoVuEoKD774dW19
26
+ bU0GOVWO+J6FMmT/Cp7nuFJ79egMf/gy4gfUfQMuvfcr6DvZUPIs9P/TlK59iMYF
27
+ DIOQ3DxdF3rMzztNUCizN4taVscEsjCcgW6WkUJnGdqlu3OHWpQxZBJkBTjPCoc6
28
+ UW6on70SFPmAy/5Cq0OJNGEWBfgD9q7rrs/X8GGwUWqXb85RXnUVi/P8Up75E0ag
29
+ 14jEc90kN+C7oI/AGCBN0j6JnEtYIEJZibjjDJTSMWlUKKkj30kq7hlUC2CepJ4v
30
+ x52qPcexcYZR7w==
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2009-04-29 00:00:00 -07:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: minitest
38
+ type: :development
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: "1.3"
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: hoe
48
+ type: :development
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.12.1
55
+ version:
56
+ description: |-
57
+ ar_mailer is a two-phase delivery agent for ActionMailer. Even delivering
58
+ email to the local machine may take too long when you have to send hundreds of
59
+ messages. ar_mailer allows you to store messages into the database for later
60
+ delivery by a separate process, ar_sendmail.
61
+ email:
62
+ - drbrain@segment7.net
63
+ executables:
64
+ - ar_sendmail
65
+ extensions: []
66
+
67
+ extra_rdoc_files:
68
+ - History.txt
69
+ - LICENSE.txt
70
+ - Manifest.txt
71
+ - README.txt
37
72
  files:
38
73
  - History.txt
39
74
  - LICENSE.txt
@@ -48,30 +83,35 @@ files:
48
83
  - test/action_mailer.rb
49
84
  - test/test_armailer.rb
50
85
  - test/test_arsendmail.rb
51
- test_files:
52
- - test/test_armailer.rb
53
- - test/test_arsendmail.rb
86
+ has_rdoc: true
87
+ homepage: http://seattlerb.rubyforge.org/ar_mailer
88
+ licenses: []
89
+
90
+ post_install_message:
54
91
  rdoc_options:
55
92
  - --main
56
93
  - README.txt
57
- extra_rdoc_files:
58
- - History.txt
59
- - LICENSE.txt
60
- - Manifest.txt
61
- - README.txt
62
- executables:
63
- - ar_sendmail
64
- extensions: []
65
-
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ version:
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: "0"
107
+ version:
66
108
  requirements: []
67
109
 
68
- dependencies:
69
- - !ruby/object:Gem::Dependency
70
- name: hoe
71
- version_requirement:
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 1.2.2
77
- version:
110
+ rubyforge_project: seattlerb
111
+ rubygems_version: 1.3.2
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: ar_mailer is a two-phase delivery agent for ActionMailer
115
+ test_files:
116
+ - test/test_armailer.rb
117
+ - test/test_arsendmail.rb
Binary file