1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/webrick/test_httpresponse.rb
tenderlove 0cbec6027c * lib/webrick/httpresponse.rb (setup_header): 1xx responses
are allowed to have Keep-Alive connections.

* test/webrick/test_httpresponse.rb: corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12 22:33:56 +00:00

49 lines
986 B
Ruby

require "webrick"
require "minitest/autorun"
module WEBrick
class TestHTTPResponse < MiniTest::Unit::TestCase
class FakeLogger
attr_reader :messages
def initialize
@messages = []
end
def warn msg
@messages << msg
end
end
attr_reader :config, :logger, :res
def setup
super
@logger = FakeLogger.new
@config = Config::HTTP
@config[:Logger] = logger
@res = HTTPResponse.new config
@res.keep_alive = true
end
def test_304_does_not_log_warning
res.status = 304
res.setup_header
assert_equal 0, logger.messages.length
end
def test_204_does_not_log_warning
res.status = 204
res.setup_header
assert_equal 0, logger.messages.length
end
def test_1xx_does_not_log_warnings
res.status = 105
res.setup_header
assert_equal 0, logger.messages.length
end
end
end