diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/rack_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/rack_test.rb b/actionpack/test/controller/rack_test.rb index 67ccf1b127..0636a85013 100644 --- a/actionpack/test/controller/rack_test.rb +++ b/actionpack/test/controller/rack_test.rb @@ -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 |