Permalink
Browse files

Merge pull request #25757 from monkey-mas/add-tests-for-response_test

Add tests for 1xx, 204 and 304 responses to response_test.rb
  • Loading branch information...
guilleiguaran committed Jul 10, 2016
2 parents 27a0716 + bddf83b commit db1582ac342be68bf5addd1b770e7dec2abe44d2
Showing with 20 additions and 0 deletions.
  1. +20 −0 actionpack/test/dispatch/response_test.rb
@@ -145,6 +145,26 @@ def test_only_set_charset_still_defaults_to_text_html
}, headers)
end
test "content length" do
[100, 101, 102, 204].each do |c|
@response = ActionDispatch::Response.new
@response.status = c.to_s
@response.set_header "Content-Length", "0"
_, headers, _ = @response.to_a
assert !headers.has_key?("Content-Length"), "#{c} must not have a Content-Length header field"
end
end
test "does not contain a message-body" do
[100, 101, 102, 204, 304].each do |c|
@response = ActionDispatch::Response.new
@response.status = c.to_s
@response.body = "Body must not be included"
_, _, body = @response.to_a
assert_empty body, "#{c} must not have a message-body but actually contains #{body}"
end
end
test "content type" do
[204, 304].each do |c|
@response = ActionDispatch::Response.new

0 comments on commit db1582a

Please sign in to comment.