ruby-changes:18276
From: tenderlove <ko1@a...>
Date: Thu, 23 Dec 2010 08:33:05 +0900 (JST)
Subject: [ruby-changes:18276] Ruby:r30299 (trunk): adding tests for Net::SMTP::Response#exception_class
tenderlove 2010-12-23 08:32:57 +0900 (Thu, 23 Dec 2010) New Revision: 30299 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30299 Log: adding tests for Net::SMTP::Response#exception_class Modified files: trunk/test/net/smtp/test_response.rb Index: test/net/smtp/test_response.rb =================================================================== --- test/net/smtp/test_response.rb (revision 30298) +++ test/net/smtp/test_response.rb (revision 30299) @@ -58,6 +58,42 @@ res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") assert_equal "250-ubuntu-desktop\n", res.message end + + def test_server_busy_exception + res = Response.parse("400 omg busy") + assert_equal Net::SMTPServerBusy, res.exception_class + res = Response.parse("410 omg busy") + assert_equal Net::SMTPServerBusy, res.exception_class + end + + def test_syntax_error_exception + res = Response.parse("500 omg syntax error") + assert_equal Net::SMTPSyntaxError, res.exception_class + + res = Response.parse("501 omg syntax error") + assert_equal Net::SMTPSyntaxError, res.exception_class + end + + def test_authentication_exception + res = Response.parse("530 omg auth error") + assert_equal Net::SMTPAuthenticationError, res.exception_class + + res = Response.parse("531 omg auth error") + assert_equal Net::SMTPAuthenticationError, res.exception_class + end + + def test_fatal_error + res = Response.parse("510 omg fatal error") + assert_equal Net::SMTPFatalError, res.exception_class + + res = Response.parse("511 omg fatal error") + assert_equal Net::SMTPFatalError, res.exception_class + end + + def test_default_exception + res = Response.parse("250 omg fatal error") + assert_equal Net::SMTPUnknownError, res.exception_class + end end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/