diff options
-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 |