1 # Copyright (c) 2005 Zed A. Shaw
2 # You can redistribute it and/or modify it under the same terms as Ruby.
4 # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5 # for more information.
7 require 'test/test_helper'
11 class ResponseTest < Test::Unit::TestCase
13 def test_response_headers
15 HttpResponse.write(out,[200, {"X-Whatever" => "stuff"}, ["cool"]])
17 assert out.length > 0, "output didn't have data"
20 def test_response_OFS_set
24 HttpResponse.write(out,[200, {"X-Whatever" => "stuff"}, ["cool"]])
26 assert ! resp.include?("\f\v"), "output didn't use $, ($OFS)"
33 HttpResponse.write(io, [200, {}, []])
34 assert io.length > 0, "output didn't have data"
37 def test_response_with_default_reason
40 HttpResponse.write(io, [code, {}, []])
42 assert_match(/.* #{HTTP_STATUS_CODES[code]}$/, io.readline.chomp, "wrong default reason phrase")