From c2355aefc99a03b8f42d2fca44c08983bdbdd087 Mon Sep 17 00:00:00 2001 From: hsbt Date: Tue, 29 Mar 2016 03:45:32 +0000 Subject: * lib/webrick/httpresponse.rb: Move error_body to method. It allow to override the body more easily. [fix GH-1307] * test/webrick/test_httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/webrick/test_httpresponse.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/webrick/test_httpresponse.rb') diff --git a/test/webrick/test_httpresponse.rb b/test/webrick/test_httpresponse.rb index b3f06cd469..d97a65b5db 100644 --- a/test/webrick/test_httpresponse.rb +++ b/test/webrick/test_httpresponse.rb @@ -146,5 +146,15 @@ module WEBrick } assert_equal 0, logger.messages.length end + + def test_set_error + status = 400 + message = 'missing attribute' + @res.status = status + error = WEBrick::HTTPStatus[status].new(message) + body = @res.set_error(error) + assert_match(/#{@res.reason_phrase}/, body) + assert_match(/#{message}/, body) + end end end -- cgit v1.2.3