zendesk-ar_mailer 1.4.6 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +54 -0
- data/README.rdoc +149 -0
- data/Rakefile +13 -19
- data/generators/ar_mailer/ar_mailer_generator.rb +25 -0
- data/generators/ar_mailer/templates/migration.rb +15 -0
- data/generators/ar_mailer/templates/model.rb +2 -0
- data/lib/action_mailer/ar_mailer.rb +9 -89
- data/lib/action_mailer/ar_sendmail.rb +65 -124
- data/lib/ar_sendmail_logger.rb +6 -1
- data/share/linux/ar_sendmail +6 -3
- data/test/{action_mailer.rb → resources/action_mailer.rb} +26 -15
- data/test/test_armailer.rb +6 -13
- data/test/test_arsendmail.rb +71 -191
- data/test/test_helper.rb +9 -0
- metadata +19 -13
- data/Manifest.txt +0 -15
- data/README.txt +0 -80
data/test/test_arsendmail.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'action_mailer'
|
3
|
-
require 'action_mailer/ar_sendmail'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'test/zentest_assertions'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
6
2
|
|
7
3
|
class ActionMailer::ARSendmail
|
8
4
|
attr_accessor :slept
|
@@ -12,7 +8,7 @@ class ActionMailer::ARSendmail
|
|
12
8
|
end
|
13
9
|
end
|
14
10
|
|
15
|
-
class TestARSendmail <
|
11
|
+
class TestARSendmail < MiniTest::Unit::TestCase
|
16
12
|
|
17
13
|
def setup
|
18
14
|
ActionMailer::Base.reset
|
@@ -22,6 +18,8 @@ class TestARSendmail < Test::Unit::TestCase
|
|
22
18
|
@sm = ActionMailer::ARSendmail.new
|
23
19
|
@sm.verbose = true
|
24
20
|
|
21
|
+
Net::SMTP.clear_on_start
|
22
|
+
|
25
23
|
@include_c_e = ! $".grep(/config\/environment.rb/).empty?
|
26
24
|
$" << 'config/environment.rb' unless @include_c_e
|
27
25
|
end
|
@@ -30,43 +28,8 @@ class TestARSendmail < Test::Unit::TestCase
|
|
30
28
|
$".delete 'config/environment.rb' unless @include_c_e
|
31
29
|
end
|
32
30
|
|
33
|
-
def
|
34
|
-
|
35
|
-
ActionMailer::ARSendmail.create_migration 'Mail'
|
36
|
-
end
|
37
|
-
|
38
|
-
expected = <<-EOF
|
39
|
-
class AddMail < ActiveRecord::Migration
|
40
|
-
def self.up
|
41
|
-
create_table :mail do |t|
|
42
|
-
t.column :from, :string
|
43
|
-
t.column :to, :string
|
44
|
-
t.column :last_send_attempt, :integer, :default => 0
|
45
|
-
t.column :mail, :text
|
46
|
-
t.column :created_on, :datetime
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.down
|
51
|
-
drop_table :mail
|
52
|
-
end
|
53
|
-
end
|
54
|
-
EOF
|
55
|
-
|
56
|
-
assert_equal expected, out
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_class_create_model
|
60
|
-
out, = util_capture do
|
61
|
-
ActionMailer::ARSendmail.create_model 'Mail'
|
62
|
-
end
|
63
|
-
|
64
|
-
expected = <<-EOF
|
65
|
-
class Mail < ActiveRecord::Base
|
66
|
-
end
|
67
|
-
EOF
|
68
|
-
|
69
|
-
assert_equal expected, out
|
31
|
+
def strip_log_prefix(line)
|
32
|
+
line.gsub(/ar_sendmail .+ \d{4}: /,'')
|
70
33
|
end
|
71
34
|
|
72
35
|
def test_class_mailq
|
@@ -76,11 +39,11 @@ end
|
|
76
39
|
:mail => 'body1'
|
77
40
|
last = Email.create :from => nobody, :to => 'recip@h2.example.com',
|
78
41
|
:mail => 'body2'
|
42
|
+
last_attempt_time = Time.parse('Thu Aug 10 2006 11:40:05')
|
43
|
+
last.last_send_attempt = last_attempt_time.to_i
|
79
44
|
|
80
|
-
|
81
|
-
|
82
|
-
out, err = util_capture do
|
83
|
-
ActionMailer::ARSendmail.mailq 'Email'
|
45
|
+
out, err = capture_io do
|
46
|
+
ActionMailer::ARSendmail.mailq
|
84
47
|
end
|
85
48
|
|
86
49
|
expected = <<-EOF
|
@@ -98,13 +61,13 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
98
61
|
-- 0 Kbytes in 3 Requests.
|
99
62
|
EOF
|
100
63
|
|
101
|
-
expected = expected %
|
64
|
+
expected = expected % last_attempt_time.strftime('%z')
|
102
65
|
assert_equal expected, out
|
103
66
|
end
|
104
67
|
|
105
68
|
def test_class_mailq_empty
|
106
|
-
out, err =
|
107
|
-
ActionMailer::ARSendmail.mailq
|
69
|
+
out, err = capture_io do
|
70
|
+
ActionMailer::ARSendmail.mailq
|
108
71
|
end
|
109
72
|
|
110
73
|
assert_equal "Mail queue is empty\n", out
|
@@ -114,17 +77,14 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
114
77
|
@sm = ActionMailer::ARSendmail.new
|
115
78
|
|
116
79
|
assert_equal 60, @sm.delay
|
117
|
-
assert_equal Email, @sm.email_class
|
118
80
|
assert_equal nil, @sm.once
|
119
81
|
assert_equal nil, @sm.verbose
|
120
82
|
assert_equal nil, @sm.batch_size
|
121
83
|
|
122
84
|
@sm = ActionMailer::ARSendmail.new :Delay => 75, :Verbose => true,
|
123
|
-
:
|
124
|
-
:BatchSize => 1000
|
85
|
+
:Once => true, :BatchSize => 1000
|
125
86
|
|
126
87
|
assert_equal 75, @sm.delay
|
127
|
-
assert_equal Object, @sm.email_class
|
128
88
|
assert_equal true, @sm.once
|
129
89
|
assert_equal true, @sm.verbose
|
130
90
|
assert_equal 1000, @sm.batch_size
|
@@ -155,7 +115,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
155
115
|
|
156
116
|
argv = %w[-c /nonexistent]
|
157
117
|
|
158
|
-
out, err =
|
118
|
+
out, err = capture_io do
|
159
119
|
assert_raises SystemExit do
|
160
120
|
ActionMailer::ARSendmail.process_args argv
|
161
121
|
end
|
@@ -218,7 +178,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
218
178
|
|
219
179
|
def test_class_parse_args_mailq
|
220
180
|
options = ActionMailer::ARSendmail.process_args []
|
221
|
-
|
181
|
+
refute_includes options, :MailQ
|
222
182
|
|
223
183
|
argv = %w[--mailq]
|
224
184
|
|
@@ -238,33 +198,11 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
238
198
|
assert_equal 86400, options[:MaxAge]
|
239
199
|
end
|
240
200
|
|
241
|
-
def test_class_parse_args_migration
|
242
|
-
options = ActionMailer::ARSendmail.process_args []
|
243
|
-
deny_includes options, :Migration
|
244
|
-
|
245
|
-
argv = %w[--create-migration]
|
246
|
-
|
247
|
-
options = ActionMailer::ARSendmail.process_args argv
|
248
|
-
|
249
|
-
assert_equal true, options[:Migrate]
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_class_parse_args_model
|
253
|
-
options = ActionMailer::ARSendmail.process_args []
|
254
|
-
deny_includes options, :Model
|
255
|
-
|
256
|
-
argv = %w[--create-model]
|
257
|
-
|
258
|
-
options = ActionMailer::ARSendmail.process_args argv
|
259
|
-
|
260
|
-
assert_equal true, options[:Model]
|
261
|
-
end
|
262
|
-
|
263
201
|
def test_class_parse_args_no_config_environment
|
264
202
|
$".delete 'config/environment.rb'
|
265
203
|
|
266
|
-
out, err =
|
267
|
-
|
204
|
+
out, err = capture_io do
|
205
|
+
assert_raises SystemExit do
|
268
206
|
ActionMailer::ARSendmail.process_args []
|
269
207
|
end
|
270
208
|
end
|
@@ -273,35 +211,6 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
273
211
|
$" << 'config/environment.rb' if @include_c_e
|
274
212
|
end
|
275
213
|
|
276
|
-
def test_class_parse_args_no_config_environment_migrate
|
277
|
-
$".delete 'config/environment.rb'
|
278
|
-
|
279
|
-
out, err = util_capture do
|
280
|
-
ActionMailer::ARSendmail.process_args %w[--create-migration]
|
281
|
-
end
|
282
|
-
|
283
|
-
assert true # count
|
284
|
-
|
285
|
-
ensure
|
286
|
-
$" << 'config/environment.rb' if @include_c_e
|
287
|
-
end
|
288
|
-
|
289
|
-
def test_class_parse_args_no_config_environment_model
|
290
|
-
$".delete 'config/environment.rb'
|
291
|
-
|
292
|
-
out, err = util_capture do
|
293
|
-
ActionMailer::ARSendmail.process_args %w[--create-model]
|
294
|
-
end
|
295
|
-
|
296
|
-
assert true # count
|
297
|
-
|
298
|
-
rescue SystemExit
|
299
|
-
flunk 'Should not exit'
|
300
|
-
|
301
|
-
ensure
|
302
|
-
$" << 'config/environment.rb' if @include_c_e
|
303
|
-
end
|
304
|
-
|
305
214
|
def test_class_parse_args_once
|
306
215
|
argv = %w[-o]
|
307
216
|
|
@@ -316,38 +225,24 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
316
225
|
assert_equal true, options[:Once]
|
317
226
|
end
|
318
227
|
|
319
|
-
def test_class_parse_args_table_name
|
320
|
-
argv = %w[-t Email]
|
321
|
-
|
322
|
-
options = ActionMailer::ARSendmail.process_args argv
|
323
|
-
|
324
|
-
assert_equal 'Email', options[:TableName]
|
325
|
-
|
326
|
-
argv = %w[--table-name=Email]
|
327
|
-
|
328
|
-
options = ActionMailer::ARSendmail.process_args argv
|
329
|
-
|
330
|
-
assert_equal 'Email', options[:TableName]
|
331
|
-
end
|
332
|
-
|
333
228
|
def test_class_usage
|
334
|
-
out, err =
|
229
|
+
out, err = capture_io do
|
335
230
|
assert_raises SystemExit do
|
336
231
|
ActionMailer::ARSendmail.usage 'opts'
|
337
232
|
end
|
338
233
|
end
|
339
234
|
|
340
235
|
assert_equal '', out
|
341
|
-
assert_equal "opts\n", err
|
236
|
+
assert_equal "opts\n", strip_log_prefix(err)
|
342
237
|
|
343
|
-
out, err =
|
238
|
+
out, err = capture_io do
|
344
239
|
assert_raises SystemExit do
|
345
240
|
ActionMailer::ARSendmail.usage 'opts', 'hi'
|
346
241
|
end
|
347
242
|
end
|
348
243
|
|
349
244
|
assert_equal '', out
|
350
|
-
assert_equal "hi\n\nopts\n", err
|
245
|
+
assert_equal "hi\n\nopts\n", strip_log_prefix(err)
|
351
246
|
end
|
352
247
|
|
353
248
|
def test_cleanup
|
@@ -357,12 +252,12 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
357
252
|
e3 = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
358
253
|
e3.last_send_attempt = Time.now
|
359
254
|
|
360
|
-
out, err =
|
255
|
+
out, err = capture_io do
|
361
256
|
@sm.cleanup
|
362
257
|
end
|
363
258
|
|
364
259
|
assert_equal '', out
|
365
|
-
|
260
|
+
assert_equal "expired 1 emails from the queue\n", strip_log_prefix(err)
|
366
261
|
assert_equal 2, Email.records.length
|
367
262
|
|
368
263
|
assert_equal [e1, e2], Email.records
|
@@ -375,7 +270,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
375
270
|
|
376
271
|
@sm.max_age = 0
|
377
272
|
|
378
|
-
out, err =
|
273
|
+
out, err = capture_io do
|
379
274
|
@sm.cleanup
|
380
275
|
end
|
381
276
|
|
@@ -383,38 +278,41 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
383
278
|
assert_equal 2, Email.records.length
|
384
279
|
end
|
385
280
|
|
386
|
-
def
|
387
|
-
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
388
|
-
|
389
|
-
out, err = util_capture do
|
390
|
-
@sm.deliver [email]
|
391
|
-
end
|
392
|
-
|
393
|
-
assert err.index('[lemon]')
|
394
|
-
|
395
|
-
email = Email.create :mail => 'body', :to => 'to', :from => 'from', :context => ''
|
281
|
+
def test_deliver
|
282
|
+
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
396
283
|
|
397
|
-
out, err =
|
284
|
+
out, err = capture_io do
|
398
285
|
@sm.deliver [email]
|
399
286
|
end
|
400
287
|
|
401
|
-
|
402
|
-
|
288
|
+
assert_equal 1, Net::SMTP.deliveries.length
|
289
|
+
assert_equal ['body', 'from', 'to'], Net::SMTP.deliveries.first
|
290
|
+
assert_equal 0, Email.records.length
|
291
|
+
assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
|
403
292
|
|
404
|
-
|
405
|
-
|
293
|
+
assert_equal '', out
|
294
|
+
assert_equal "sent email 00000000001 from from to to: \"queued\"\n", strip_log_prefix(err)
|
295
|
+
end
|
406
296
|
|
407
|
-
|
297
|
+
def test_log_header_setting
|
298
|
+
email = Email.create :mail => "Mailer: JunkMail 1.0\r\nX-Track: 7890\r\n\r\nbody", :to => 'to', :from => 'from'
|
299
|
+
@sm.log_header = 'X-Track'
|
300
|
+
out, err = capture_io do
|
408
301
|
@sm.deliver [email]
|
409
302
|
end
|
410
303
|
|
411
304
|
assert_equal 1, Net::SMTP.deliveries.length
|
412
|
-
assert_equal ['body', 'from', 'to'], Net::SMTP.deliveries.first
|
413
305
|
assert_equal 0, Email.records.length
|
414
306
|
assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
|
415
307
|
|
416
308
|
assert_equal '', out
|
417
|
-
|
309
|
+
assert_equal "sent email 00000000001 [7890] from from to to: \"queued\"\n", strip_log_prefix(err)
|
310
|
+
end
|
311
|
+
|
312
|
+
def test_deliver_not_called_when_no_emails
|
313
|
+
sm = ActionMailer::ARSendmail.new({:Once => true})
|
314
|
+
sm.expects(:deliver).never
|
315
|
+
sm.run
|
418
316
|
end
|
419
317
|
|
420
318
|
def test_deliver_auth_error
|
@@ -428,7 +326,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
428
326
|
|
429
327
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
430
328
|
|
431
|
-
out, err =
|
329
|
+
out, err = capture_io do
|
432
330
|
@sm.deliver [email]
|
433
331
|
end
|
434
332
|
|
@@ -440,21 +338,20 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
440
338
|
assert_equal [60], @sm.slept
|
441
339
|
|
442
340
|
assert_equal '', out
|
443
|
-
|
341
|
+
assert_equal "authentication error, retrying: try again\n", strip_log_prefix(err)
|
444
342
|
end
|
445
343
|
|
446
344
|
def test_deliver_auth_error_recover
|
447
345
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
448
346
|
@sm.failed_auth_count = 1
|
449
347
|
|
450
|
-
out, err =
|
348
|
+
out, err = capture_io do @sm.deliver [email] end
|
451
349
|
|
452
350
|
assert_equal 0, @sm.failed_auth_count
|
453
351
|
assert_equal 1, Net::SMTP.deliveries.length
|
454
352
|
end
|
455
353
|
|
456
354
|
def test_deliver_auth_error_twice
|
457
|
-
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
458
355
|
Net::SMTP.on_start do
|
459
356
|
e = Net::SMTPAuthenticationError.new 'try again'
|
460
357
|
e.set_backtrace %w[one two three]
|
@@ -463,30 +360,16 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
463
360
|
|
464
361
|
@sm.failed_auth_count = 1
|
465
362
|
|
466
|
-
out, err =
|
467
|
-
|
468
|
-
@sm.deliver [
|
363
|
+
out, err = capture_io do
|
364
|
+
assert_raises Net::SMTPAuthenticationError do
|
365
|
+
@sm.deliver []
|
469
366
|
end
|
470
367
|
end
|
471
368
|
|
472
369
|
assert_equal 2, @sm.failed_auth_count
|
473
|
-
|
370
|
+
assert_equal "authentication error, giving up: try again\n", strip_log_prefix(err)
|
474
371
|
end
|
475
372
|
|
476
|
-
def test_deliver_no_auth_without_emails
|
477
|
-
Net::SMTP.on_start do
|
478
|
-
e = Net::SMTPAuthenticationError.new 'no throw'
|
479
|
-
e.set_backtrace %w[one two three]
|
480
|
-
raise e
|
481
|
-
end
|
482
|
-
|
483
|
-
out, err = util_capture do
|
484
|
-
@sm.deliver []
|
485
|
-
end
|
486
|
-
assert_equal '', err, "authentication attempt without any emails to send"
|
487
|
-
assert_equal 0, Net::SMTP.deliveries.length
|
488
|
-
end
|
489
|
-
|
490
373
|
def test_deliver_4xx_error
|
491
374
|
Net::SMTP.on_send_message do
|
492
375
|
e = Net::SMTPSyntaxError.new 'try again'
|
@@ -498,7 +381,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
498
381
|
|
499
382
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
500
383
|
|
501
|
-
out, err =
|
384
|
+
out, err = capture_io do
|
502
385
|
@sm.deliver [email]
|
503
386
|
end
|
504
387
|
|
@@ -508,7 +391,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
508
391
|
assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
|
509
392
|
|
510
393
|
assert_equal '', out
|
511
|
-
|
394
|
+
assert_equal "error sending email 1: \"try again\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\n", strip_log_prefix(err)
|
512
395
|
end
|
513
396
|
|
514
397
|
def test_deliver_5xx_error
|
@@ -522,7 +405,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
522
405
|
|
523
406
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
524
407
|
|
525
|
-
out, err =
|
408
|
+
out, err = capture_io do
|
526
409
|
@sm.deliver [email]
|
527
410
|
end
|
528
411
|
|
@@ -531,7 +414,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
531
414
|
assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
|
532
415
|
|
533
416
|
assert_equal '', out
|
534
|
-
|
417
|
+
assert_equal "5xx error sending email 1, removing from queue: \"unknown recipient\"(Net::SMTPFatalError):\n\tone\n\ttwo\n\tthree\n", strip_log_prefix(err)
|
535
418
|
end
|
536
419
|
|
537
420
|
def test_deliver_errno_epipe
|
@@ -543,7 +426,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
543
426
|
|
544
427
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
545
428
|
|
546
|
-
out, err =
|
429
|
+
out, err = capture_io do
|
547
430
|
@sm.deliver [email]
|
548
431
|
end
|
549
432
|
|
@@ -567,7 +450,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
567
450
|
|
568
451
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
569
452
|
|
570
|
-
out, err =
|
453
|
+
out, err = capture_io do
|
571
454
|
@sm.deliver [email]
|
572
455
|
end
|
573
456
|
|
@@ -578,7 +461,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
578
461
|
assert_equal [60], @sm.slept
|
579
462
|
|
580
463
|
assert_equal '', out
|
581
|
-
|
464
|
+
assert_equal "server too busy, sleeping 60 seconds\n", strip_log_prefix(err)
|
582
465
|
end
|
583
466
|
|
584
467
|
def test_deliver_syntax_error
|
@@ -594,7 +477,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
594
477
|
email1 = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
595
478
|
email2 = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
596
479
|
|
597
|
-
out, err =
|
480
|
+
out, err = capture_io do
|
598
481
|
@sm.deliver [email1, email2]
|
599
482
|
end
|
600
483
|
|
@@ -604,9 +487,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
604
487
|
assert_operator now, :<=, Email.records.first.last_send_attempt
|
605
488
|
|
606
489
|
assert_equal '', out
|
607
|
-
|
608
|
-
assert err.index("error sending email 1: \"blah blah blah\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\n")
|
609
|
-
assert err.index("sent email 00000000002 from from to to: \"queued\"\n")
|
490
|
+
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", strip_log_prefix(err)
|
610
491
|
end
|
611
492
|
|
612
493
|
def test_deliver_timeout
|
@@ -620,7 +501,7 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
620
501
|
|
621
502
|
email = Email.create :mail => 'body', :to => 'to', :from => 'from'
|
622
503
|
|
623
|
-
out, err =
|
504
|
+
out, err = capture_io do
|
624
505
|
@sm.deliver [email]
|
625
506
|
end
|
626
507
|
|
@@ -630,26 +511,26 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
630
511
|
assert_equal 1, Net::SMTP.reset_called, 'Reset connection on Timeout'
|
631
512
|
|
632
513
|
assert_equal '', out
|
633
|
-
|
514
|
+
assert_equal "error sending email 1: \"timed out\"(Timeout::Error):\n\tone\n\ttwo\n\tthree\n", strip_log_prefix(err)
|
634
515
|
end
|
635
516
|
|
636
517
|
def test_do_exit
|
637
|
-
out, err =
|
638
|
-
|
518
|
+
out, err = capture_io do
|
519
|
+
assert_raises SystemExit do
|
639
520
|
@sm.do_exit
|
640
521
|
end
|
641
522
|
end
|
642
523
|
|
643
524
|
assert_equal '', out
|
644
|
-
|
525
|
+
assert_equal "caught signal, shutting down\n", strip_log_prefix(err)
|
645
526
|
end
|
646
527
|
|
647
528
|
def test_log
|
648
|
-
out, err =
|
529
|
+
out, err = capture_io do
|
649
530
|
@sm.log 'hi'
|
650
531
|
end
|
651
532
|
|
652
|
-
|
533
|
+
assert_equal "hi\n", strip_log_prefix(err)
|
653
534
|
end
|
654
535
|
|
655
536
|
def test_find_emails
|
@@ -668,14 +549,14 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
668
549
|
|
669
550
|
found_emails = []
|
670
551
|
|
671
|
-
out, err =
|
552
|
+
out, err = capture_io do
|
672
553
|
found_emails = @sm.find_emails
|
673
554
|
end
|
674
555
|
|
675
556
|
assert_equal emails, found_emails
|
676
557
|
|
677
558
|
assert_equal '', out
|
678
|
-
|
559
|
+
assert_equal "found 3 emails to send\n", strip_log_prefix(err)
|
679
560
|
end
|
680
561
|
|
681
562
|
def test_smtp_settings
|
@@ -689,4 +570,3 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
|
|
689
570
|
end
|
690
571
|
|
691
572
|
end
|
692
|
-
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk-ar_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
8
|
+
- Adam Meehan
|
9
|
+
- Morten Primdahl
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
13
|
|
12
|
-
date:
|
14
|
+
date: 2009-12-14 00:00:00 -05:00
|
13
15
|
default_executable: ar_sendmail
|
14
16
|
dependencies: []
|
15
17
|
|
16
18
|
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.
|
17
|
-
email:
|
19
|
+
email: adam.meehan@gmail.com
|
18
20
|
executables:
|
19
21
|
- ar_sendmail
|
20
22
|
extensions: []
|
@@ -22,31 +24,35 @@ extensions: []
|
|
22
24
|
extra_rdoc_files:
|
23
25
|
- History.txt
|
24
26
|
- LICENSE.txt
|
25
|
-
-
|
26
|
-
- README.txt
|
27
|
+
- README.rdoc
|
27
28
|
files:
|
28
29
|
- History.txt
|
29
30
|
- LICENSE.txt
|
30
|
-
-
|
31
|
-
- README.txt
|
31
|
+
- README.rdoc
|
32
32
|
- Rakefile
|
33
33
|
- bin/ar_sendmail
|
34
|
+
- generators/ar_mailer/ar_mailer_generator.rb
|
35
|
+
- generators/ar_mailer/templates/migration.rb
|
36
|
+
- generators/ar_mailer/templates/model.rb
|
34
37
|
- lib/action_mailer/ar_mailer.rb
|
35
38
|
- lib/action_mailer/ar_sendmail.rb
|
36
|
-
- lib/ar_sendmail_logger.rb
|
37
39
|
- lib/smtp_tls.rb
|
40
|
+
- lib/ar_sendmail_logger.rb
|
38
41
|
- share/bsd/ar_sendmail
|
39
42
|
- share/linux/ar_sendmail
|
40
43
|
- share/linux/ar_sendmail.conf
|
41
|
-
- test/action_mailer.rb
|
44
|
+
- test/resources/action_mailer.rb
|
42
45
|
- test/test_armailer.rb
|
43
46
|
- test/test_arsendmail.rb
|
47
|
+
- test/test_helper.rb
|
44
48
|
has_rdoc: true
|
45
|
-
homepage: http://
|
49
|
+
homepage: http://github.com/zendesk/ar_mailer
|
50
|
+
licenses: []
|
51
|
+
|
46
52
|
post_install_message:
|
47
53
|
rdoc_options:
|
48
54
|
- --main
|
49
|
-
- README.
|
55
|
+
- README.rdoc
|
50
56
|
require_paths:
|
51
57
|
- lib
|
52
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -64,9 +70,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
70
|
requirements: []
|
65
71
|
|
66
72
|
rubyforge_project: seattlerb
|
67
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.3.5
|
68
74
|
signing_key:
|
69
|
-
specification_version:
|
75
|
+
specification_version: 3
|
70
76
|
summary: A two-phase delivery agent for ActionMailer
|
71
77
|
test_files:
|
72
78
|
- test/test_armailer.rb
|
data/Manifest.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
LICENSE.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
bin/ar_sendmail
|
7
|
-
lib/action_mailer/ar_mailer.rb
|
8
|
-
lib/action_mailer/ar_sendmail.rb
|
9
|
-
lib/smtp_tls.rb
|
10
|
-
share/bsd/ar_sendmail
|
11
|
-
share/linux/ar_sendmail
|
12
|
-
share/linux/ar_sendmail.conf
|
13
|
-
test/action_mailer.rb
|
14
|
-
test/test_armailer.rb
|
15
|
-
test/test_arsendmail.rb
|