blob: 3967e2c3e843478f73f203c8eddc36219a7f65bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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
def test_304_does_not_log_warning
logger = FakeLogger.new
config = Config::HTTP
config[:Logger] = logger
res = HTTPResponse.new config
res.status = 304
res.keep_alive = true
res.setup_header
assert_equal 0, logger.messages.length
end
def test_204_does_not_log_warning
logger = FakeLogger.new
config = Config::HTTP
config[:Logger] = logger
res = HTTPResponse.new config
res.status = 204
res.keep_alive = true
res.setup_header
assert_equal 0, logger.messages.length
end
end
end
|