Permalink
Browse files

Tests for rack response content type

  • Loading branch information...
1 parent be078ee commit 3343eb428c502006c40368231a154d8f82be97eb @lifo lifo committed Jul 16, 2008
Showing with 21 additions and 0 deletions.
  1. +21 −0 actionpack/test/controller/rack_test.rb
@@ -246,3 +246,24 @@ def test_set_session_cookie
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

0 comments on commit 3343eb4

Please sign in to comment.