Skip to content

Commit

Permalink
Tests for rack response content type
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Jul 16, 2008
1 parent be078ee commit 3343eb4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions actionpack/test/controller/rack_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.