From 3971bc3c70f12a21907069d4426a3391b1e05c53 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Wed, 22 Dec 2010 23:26:05 +0000 Subject: adding more tests for Net::SMTP::Response class git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/smtp/test_response.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/net/smtp') diff --git a/test/net/smtp/test_response.rb b/test/net/smtp/test_response.rb index 696a72157f..d810bf0b93 100644 --- a/test/net/smtp/test_response.rb +++ b/test/net/smtp/test_response.rb @@ -32,6 +32,32 @@ module Net res = Response.parse("badstring") assert_equal({}, res.capabilities) end + + def test_success? + res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert res.success? + assert !res.continue? + end + + # RFC 2821, Section 4.2.1 + def test_continue? + res = Response.parse("3yz-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert !res.success? + assert res.continue? + end + + def test_status_type_char + res = Response.parse("3yz-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert_equal '3', res.status_type_char + + res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert_equal '2', res.status_type_char + end + + def test_message + res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert_equal "250-ubuntu-desktop\n", res.message + end end end end -- cgit v1.2.3