[前][次][番号順一覧][スレッド一覧]

ruby-changes:18275

From: tenderlove <ko1@a...>
Date: Thu, 23 Dec 2010 08:28:26 +0900 (JST)
Subject: [ruby-changes:18275] Ruby:r30298 (trunk): adding more tests for Net::SMTP::Response class

tenderlove	2010-12-23 08:26:05 +0900 (Thu, 23 Dec 2010)

  New Revision: 30298

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30298

  Log:
    adding more tests for Net::SMTP::Response class

  Modified files:
    trunk/lib/net/smtp.rb
    trunk/test/net/smtp/test_response.rb

Index: lib/net/smtp.rb
===================================================================
--- lib/net/smtp.rb	(revision 30297)
+++ lib/net/smtp.rb	(revision 30298)
@@ -968,7 +968,7 @@
     end
 
     class Response
-      def Response.parse(str)
+      def self.parse(str)
         new(str[0,3], str)
       end
 
Index: test/net/smtp/test_response.rb
===================================================================
--- test/net/smtp/test_response.rb	(revision 30297)
+++ test/net/smtp/test_response.rb	(revision 30298)
@@ -32,6 +32,32 @@
         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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]