summaryrefslogtreecommitdiff
path: root/test/net/smtp/test_response.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-22 23:32:57 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-22 23:32:57 +0000
commit26e6372a8718e2670890dcab0db4f9adac515d3e (patch)
tree7cd088cdd620dceda54d64db60e57b1960e0e0a5 /test/net/smtp/test_response.rb
parent3971bc3c70f12a21907069d4426a3391b1e05c53 (diff)
adding tests for Net::SMTP::Response#exception_class
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/smtp/test_response.rb')
-rw-r--r--test/net/smtp/test_response.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/net/smtp/test_response.rb b/test/net/smtp/test_response.rb
index d810bf0b93..e7011e0fb5 100644
--- a/test/net/smtp/test_response.rb
+++ b/test/net/smtp/test_response.rb
@@ -58,6 +58,42 @@ module Net
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