Tests for rack response content type

This commit is contained in:
Pratik Naik 2008-07-16 04:09:01 +01:00
parent be078ee162
commit 3343eb428c
1 changed files with 21 additions and 0 deletions

View File

@ -246,3 +246,24 @@ class RackResponseTest < BaseRackTest
assert_equal ["Hello, World!"], parts
end
end
class RackResponseHeadersTest < BaseRackTest
def setup
super
@response = ActionController::RackResponse.new(@request)
@output = StringIO.new('')
@headers = proc { @response.out(@output)[1] }
end
def test_content_type
[204, 304].each do |c|
@response.headers['Status'] = c
assert !@headers.call.has_key?("Content-Type")
end
[200, 302, 404, 500].each do |c|
@response.headers['Status'] = c
assert @headers.call.has_key?("Content-Type")
end
end
end