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

ruby-changes:31875

From: drbrain <ko1@a...>
Date: Mon, 2 Dec 2013 14:18:17 +0900 (JST)
Subject: [ruby-changes:31875] drbrain:r43954 (trunk): * lib/net/smtp.rb (Net::SMTP#critical): Always return a

drbrain	2013-12-02 14:18:04 +0900 (Mon, 02 Dec 2013)

  New Revision: 43954

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

  Log:
    * lib/net/smtp.rb (Net::SMTP#critical):  Always return a
      Net::SMTP::Response.  Patch by Pawel Veselov.
      [ruby-trunk - Bug #9125]
    * test/net/smtp/test_smtp.rb:  Test for the above.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/smtp.rb
    trunk/test/net/smtp/test_smtp.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43953)
+++ ChangeLog	(revision 43954)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  2 14:16:52 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/net/smtp.rb (Net::SMTP#critical):  Always return a
+	  Net::SMTP::Response.  Patch by Pawel Veselov.
+	  [ruby-trunk - Bug #9125]
+	* test/net/smtp/test_smtp.rb:  Test for the above.
+
 Mon Dec  2 05:52:33 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems:  Update to RubyGems master baa965b.  Notable changes:
Index: lib/net/smtp.rb
===================================================================
--- lib/net/smtp.rb	(revision 43953)
+++ lib/net/smtp.rb	(revision 43954)
@@ -942,7 +942,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/smtp.rb#L942
     end
 
     def critical
-      return '200 dummy reply code' if @error_occurred
+      return Response.parse('200 dummy reply code') if @error_occurred
       begin
         return yield()
       rescue Exception
Index: test/net/smtp/test_smtp.rb
===================================================================
--- test/net/smtp/test_smtp.rb	(revision 43953)
+++ test/net/smtp/test_smtp.rb	(revision 43954)
@@ -21,6 +21,19 @@ module Net https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_smtp.rb#L21
       end
     end
 
+    def test_critical
+      smtp = Net::SMTP.new 'localhost', 25
+
+      assert_raises RuntimeError do
+        smtp.send :critical do
+          raise 'fail on purpose'
+        end
+      end
+
+      assert_kind_of Net::SMTP::Response, smtp.send(:critical),
+                     '[Bug #9125]'
+    end
+
     def test_esmtp
       smtp = Net::SMTP.new 'localhost', 25
       assert smtp.esmtp

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

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