diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2016-07-10 13:45:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-10 13:45:59 -0500 |
commit | db1582ac342be68bf5addd1b770e7dec2abe44d2 (patch) | |
tree | 76eb61b33e0c587ba8998d1572c5a0975d7c836c /actionpack | |
parent | 27a07165d5d69291a89e3b902d5406ecba25dcbb (diff) | |
parent | bddf83bfcf662f54ffe20d2687f4227a8730eee2 (diff) | |
download | rails-db1582ac342be68bf5addd1b770e7dec2abe44d2.tar.gz rails-db1582ac342be68bf5addd1b770e7dec2abe44d2.tar.bz2 rails-db1582ac342be68bf5addd1b770e7dec2abe44d2.zip |
Merge pull request #25757 from monkey-mas/add-tests-for-response_test
Add tests for 1xx, 204 and 304 responses to response_test.rb
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/dispatch/response_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index aa90433505..9eed796d3c 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -145,6 +145,26 @@ class ResponseTest < ActiveSupport::TestCase }, 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 |