1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
tenderlove 2010-12-22 23:26:05 +00:00
parent d236a0ca3b
commit 3971bc3c70
2 changed files with 27 additions and 1 deletions

View file

@ -968,7 +968,7 @@ module Net
end
class Response
def Response.parse(str)
def self.parse(str)
new(str[0,3], str)
end

View file

@ -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