diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-22 23:09:05 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-22 23:09:05 +0000 |
commit | df8e7db7c5f296df63db09e2b041336f0a8c6452 (patch) | |
tree | 5135cb8279fb466e3b072e920d07983b7bfb879e /test/net/smtp | |
parent | 4a7f4d1f4874898a89f929102d03d7ce5821045d (diff) | |
download | ruby-df8e7db7c5f296df63db09e2b041336f0a8c6452.tar.gz |
adding tests for the SMTP response parser
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/smtp')
-rw-r--r-- | test/net/smtp/test_response.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/net/smtp/test_response.rb b/test/net/smtp/test_response.rb new file mode 100644 index 0000000000..696a72157f --- /dev/null +++ b/test/net/smtp/test_response.rb @@ -0,0 +1,37 @@ +require 'net/smtp' +require 'minitest/autorun' + +module Net + class SMTP + class TestResponse < MiniTest::Unit::TestCase + def test_capabilities + res = Response.parse("250-ubuntu-desktop\n250-PIPELINING\n250-SIZE 10240000\n250-VRFY\n250-ETRN\n250-STARTTLS\n250-ENHANCEDSTATUSCODES\n250 DSN\n") + + capabilities = res.capabilities + %w{ PIPELINING SIZE VRFY STARTTLS ENHANCEDSTATUSCODES DSN}.each do |str| + assert capabilities.key?(str), str + end + end + + def test_capabilities_default + res = Response.parse("250-ubuntu-desktop\n250-PIPELINING\n250 DSN\n") + assert_equal [], res.capabilities['PIPELINING'] + end + + def test_capabilities_value + res = Response.parse("250-ubuntu-desktop\n250-SIZE 1234\n250 DSN\n") + assert_equal ['1234'], res.capabilities['SIZE'] + end + + def test_capabilities_multi + res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") + assert_equal %w{1 2 3}, res.capabilities['SIZE'] + end + + def test_bad_string + res = Response.parse("badstring") + assert_equal({}, res.capabilities) + end + end + end +end |