diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-11 07:22:37 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-11 07:22:37 +0000 |
commit | 370a88b2e428a41008d2f9e4e2c2a4ed215ab873 (patch) | |
tree | d051124162f20217b092959a084e35b1720409ec /test | |
parent | e577ab7e62af6674acf3292eda9f604981b48202 (diff) | |
download | unicorn-370a88b2e428a41008d2f9e4e2c2a4ed215ab873.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@640 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'test')
-rw-r--r-- | test/test_response.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_response.rb b/test/test_response.rb index 584b28f..90953b1 100644 --- a/test/test_response.rb +++ b/test/test_response.rb @@ -102,5 +102,28 @@ class ResponseTest < Test::Unit::TestCase assert io.length > 0, "output didn't have data" assert io.read[-contents.length..-1] == contents, "output doesn't end with file payload" end + + def test_response_with_custom_reason + reason = "You made a bad request" + io = StringIO.new + resp = HttpResponse.new(io) + resp.start(400, false, reason) { |head,out| } + resp.finished + + io.rewind + assert_match(/.* #{reason}$/, io.readline.chomp, "wrong custom reason phrase") + end + + def test_response_with_default_reason + code = 400 + io = StringIO.new + resp = HttpResponse.new(io) + resp.start(code) { |head,out| } + resp.finished + + io.rewind + assert_match(/.* #{HTTP_STATUS_CODES[code]}$/, io.readline.chomp, "wrong default reason phrase") + end + end |