diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-24 16:21:37 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-24 16:21:37 +0000 |
commit | 38bbe3741dc592c0835b71aed1955f8b18c6e5e2 (patch) | |
tree | 9c771abfb2a46b68cd4bf4cd2cce12d7da31ef9e | |
parent | bcef849df94fc48bd9c99472303f2fb7cf251f17 (diff) |
merge revision(s) 43954: [Backport #9125]
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/net/smtp.rb | 2 | ||||
-rw-r--r-- | test/net/smtp/test_smtp.rb | 13 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Wed Dec 25 00:46:44 2013 Eric Hodel <drbrain@segment7.net> + + * 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. + Wed Dec 25 00:18:19 2013 Tanaka Akira <akr@fsij.org> * ext/socket/lib/socket.rb: Don't test $! in "ensure" clause because diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index da8f18ff5c..11d16b1216 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -936,7 +936,7 @@ module Net 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 diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb index 8af6a37d53..ba2943db56 100644 --- a/test/net/smtp/test_smtp.rb +++ b/test/net/smtp/test_smtp.rb @@ -3,6 +3,19 @@ require 'minitest/autorun' module Net class TestSMTP < MiniTest::Unit::TestCase + 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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-12-25" -#define RUBY_PATCHLEVEL 375 +#define RUBY_PATCHLEVEL 376 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 12 |