diff --git a/ChangeLog b/ChangeLog index ea6998837d..bdbb4392f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Dec 2 14:16:52 2013 Eric Hodel + + * 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 * lib/rubygems: Update to RubyGems master baa965b. Notable changes: diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 4ed7e746d9..fdc911b82e 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -942,7 +942,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 0b8d657559..748b20d65b 100644 --- a/test/net/smtp/test_smtp.rb +++ b/test/net/smtp/test_smtp.rb @@ -21,6 +21,19 @@ module Net 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