diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-07-16 04:09:01 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-16 04:09:41 +0100 |
commit | 3343eb428c502006c40368231a154d8f82be97eb (patch) | |
tree | 0078be4bafc86a48677c35598f9d6bc4f0059ae7 /actionpack/test/controller | |
parent | be078ee162fcae883a5621a30929879cd783a238 (diff) | |
download | rails-3343eb428c502006c40368231a154d8f82be97eb.tar.gz rails-3343eb428c502006c40368231a154d8f82be97eb.tar.bz2 rails-3343eb428c502006c40368231a154d8f82be97eb.zip |
Tests for rack response content type
Diffstat (limited to 'actionpack/test/controller')
-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 |