Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed tests for latest ZenTest test assertations changes

  • Loading branch information...
commit 05bca9e4a3cae47e6c1e6a99be5f4df50ddbfb10 1 parent 37b843b
Adam Meehan adzap authored

Showing 1 changed file with 38 additions and 37 deletions. Show diff stats Hide diff stats

  1. +38 37 test/test_arsendmail.rb
75 test/test_arsendmail.rb
@@ -53,7 +53,7 @@ def self.down
53 53 end
54 54 EOF
55 55
56   - assert_equal expected, out.string
  56 + assert_equal expected, out
57 57 end
58 58
59 59 def test_class_create_model
@@ -66,7 +66,7 @@ class Mail < ActiveRecord::Base
66 66 end
67 67 EOF
68 68
69   - assert_equal expected, out.string
  69 + assert_equal expected, out
70 70 end
71 71
72 72 def test_class_mailq
@@ -92,13 +92,14 @@ def test_class_mailq
92 92 recip@h1.example.com
93 93
94 94 3 5 Thu Aug 10 11:19:51 nobody@example.com
95   -Last send attempt: Thu Aug 10 11:40:05 -0700 2006
  95 +Last send attempt: Thu Aug 10 11:40:05 %s 2006
96 96 recip@h2.example.com
97 97
98 98 -- 0 Kbytes in 3 Requests.
99 99 EOF
100 100
101   - assert_equal expected, out.string
  101 + expected = expected % Time.new.strftime('%z')
  102 + assert_equal expected, out
102 103 end
103 104
104 105 def test_class_mailq_empty
@@ -106,7 +107,7 @@ def test_class_mailq_empty
106 107 ActionMailer::ARSendmail.mailq 'Email'
107 108 end
108 109
109   - assert_equal "Mail queue is empty\n", out.string
  110 + assert_equal "Mail queue is empty\n", out
110 111 end
111 112
112 113 def test_class_new
@@ -203,7 +204,7 @@ def test_class_parse_args_environment
203 204
204 205 def test_class_parse_args_mailq
205 206 options = ActionMailer::ARSendmail.process_args []
206   - deny_includes :MailQ, options
  207 + deny_includes options, :MailQ
207 208
208 209 argv = %w[--mailq]
209 210
@@ -225,7 +226,7 @@ def test_class_parse_args_max_age
225 226
226 227 def test_class_parse_args_migration
227 228 options = ActionMailer::ARSendmail.process_args []
228   - deny_includes :Migration, options
  229 + deny_includes options, :Migration
229 230
230 231 argv = %w[--create-migration]
231 232
@@ -236,7 +237,7 @@ def test_class_parse_args_migration
236 237
237 238 def test_class_parse_args_model
238 239 options = ActionMailer::ARSendmail.process_args []
239   - deny_includes :Model, options
  240 + deny_includes options, :Model
240 241
241 242 argv = %w[--create-model]
242 243
@@ -322,8 +323,8 @@ def test_class_usage
322 323 end
323 324 end
324 325
325   - assert_equal '', out.string
326   - assert_equal "opts\n", err.string
  326 + assert_equal '', out
  327 + assert_equal "opts\n", err
327 328
328 329 out, err = util_capture do
329 330 assert_raises SystemExit do
@@ -331,8 +332,8 @@ def test_class_usage
331 332 end
332 333 end
333 334
334   - assert_equal '', out.string
335   - assert_equal "hi\n\nopts\n", err.string
  335 + assert_equal '', out
  336 + assert_equal "hi\n\nopts\n", err
336 337 end
337 338
338 339 def test_cleanup
@@ -346,8 +347,8 @@ def test_cleanup
346 347 @sm.cleanup
347 348 end
348 349
349   - assert_equal '', out.string
350   - assert_equal "expired 1 emails from the queue\n", err.string
  350 + assert_equal '', out
  351 + assert_equal "expired 1 emails from the queue\n", err
351 352 assert_equal 2, Email.records.length
352 353
353 354 assert_equal [e1, e2], Email.records
@@ -364,7 +365,7 @@ def test_cleanup_disabled
364 365 @sm.cleanup
365 366 end
366 367
367   - assert_equal '', out.string
  368 + assert_equal '', out
368 369 assert_equal 2, Email.records.length
369 370 end
370 371
@@ -380,8 +381,8 @@ def test_deliver
380 381 assert_equal 0, Email.records.length
381 382 assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
382 383
383   - assert_equal '', out.string
384   - assert_equal "sent email 00000000001 from from to to: \"queued\"\n", err.string
  384 + assert_equal '', out
  385 + assert_equal "sent email 00000000001 from from to to: \"queued\"\n", err
385 386 end
386 387
387 388 def test_deliver_auth_error
@@ -406,8 +407,8 @@ def test_deliver_auth_error
406 407 assert_equal 1, @sm.failed_auth_count
407 408 assert_equal [60], @sm.slept
408 409
409   - assert_equal '', out.string
410   - assert_equal "authentication error, retrying: try again\n", err.string
  410 + assert_equal '', out
  411 + assert_equal "authentication error, retrying: try again\n", err
411 412 end
412 413
413 414 def test_deliver_auth_error_recover
@@ -436,7 +437,7 @@ def test_deliver_auth_error_twice
436 437 end
437 438
438 439 assert_equal 2, @sm.failed_auth_count
439   - assert_equal "authentication error, giving up: try again\n", err.string
  440 + assert_equal "authentication error, giving up: try again\n", err
440 441 end
441 442
442 443 def test_deliver_4xx_error
@@ -459,8 +460,8 @@ def test_deliver_4xx_error
459 460 assert_operator now, :<=, Email.records.first.last_send_attempt
460 461 assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
461 462
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
  463 + assert_equal '', out
  464 + assert_equal "error sending email 1: \"try again\"(Net::SMTPSyntaxError):\n\tone\n\ttwo\n\tthree\n", err
464 465 end
465 466
466 467 def test_deliver_5xx_error
@@ -482,8 +483,8 @@ def test_deliver_5xx_error
482 483 assert_equal 0, Email.records.length
483 484 assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
484 485
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
  486 + assert_equal '', out
  487 + assert_equal "5xx error sending email 1, removing from queue: \"unknown recipient\"(Net::SMTPFatalError):\n\tone\n\ttwo\n\tthree\n", err
487 488 end
488 489
489 490 def test_deliver_errno_epipe
@@ -504,8 +505,8 @@ def test_deliver_errno_epipe
504 505 assert_operator now, :>=, Email.records.first.last_send_attempt
505 506 assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
506 507
507   - assert_equal '', out.string
508   - assert_equal '', err.string
  508 + assert_equal '', out
  509 + assert_equal '', err
509 510 end
510 511
511 512 def test_deliver_server_busy
@@ -529,8 +530,8 @@ def test_deliver_server_busy
529 530 assert_equal 0, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
530 531 assert_equal [60], @sm.slept
531 532
532   - assert_equal '', out.string
533   - assert_equal "server too busy, sleeping 60 seconds\n", err.string
  533 + assert_equal '', out
  534 + assert_equal "server too busy, sleeping 60 seconds\n", err
534 535 end
535 536
536 537 def test_deliver_syntax_error
@@ -555,8 +556,8 @@ def test_deliver_syntax_error
555 556 assert_equal 1, Net::SMTP.reset_called, 'Reset connection on SyntaxError'
556 557 assert_operator now, :<=, Email.records.first.last_send_attempt
557 558
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
  559 + assert_equal '', out
  560 + 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 561 end
561 562
562 563 def test_deliver_timeout
@@ -579,8 +580,8 @@ def test_deliver_timeout
579 580 assert_operator now, :>=, Email.records.first.last_send_attempt
580 581 assert_equal 1, Net::SMTP.reset_called, 'Reset connection on Timeout'
581 582
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
  583 + assert_equal '', out
  584 + assert_equal "error sending email 1: \"timed out\"(Timeout::Error):\n\tone\n\ttwo\n\tthree\n", err
584 585 end
585 586
586 587 def test_do_exit
@@ -590,8 +591,8 @@ def test_do_exit
590 591 end
591 592 end
592 593
593   - assert_equal '', out.string
594   - assert_equal "caught signal, shutting down\n", err.string
  594 + assert_equal '', out
  595 + assert_equal "caught signal, shutting down\n", err
595 596 end
596 597
597 598 def test_log
@@ -599,7 +600,7 @@ def test_log
599 600 @sm.log 'hi'
600 601 end
601 602
602   - assert_equal "hi\n", err.string
  603 + assert_equal "hi\n", err
603 604 end
604 605
605 606 def test_find_emails
@@ -624,8 +625,8 @@ def test_find_emails
624 625
625 626 assert_equal emails, found_emails
626 627
627   - assert_equal '', out.string
628   - assert_equal "found 3 emails to send\n", err.string
  628 + assert_equal '', out
  629 + assert_equal "found 3 emails to send\n", err
629 630 end
630 631
631 632 def test_smtp_settings

0 comments on commit 05bca9e

Please sign in to comment.
Something went wrong with that request. Please try again.