diff options
author | José Valim <jose.valim@gmail.com> | 2012-05-03 22:52:08 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-05-03 22:52:08 -0700 |
commit | 5f62c86b50f21ef14ffda1112a8cd002e87590ca (patch) | |
tree | cdf9411f083acd7f0f2cb6dbbcea6f465c99b34c /actionpack/test/controller/new_base | |
parent | 4f77f956a8458c611c58975fb54094dea05a83e3 (diff) | |
parent | 8edd21c66fee41f755cf962e898646005ae866c0 (diff) | |
download | rails-5f62c86b50f21ef14ffda1112a8cd002e87590ca.tar.gz rails-5f62c86b50f21ef14ffda1112a8cd002e87590ca.tar.bz2 rails-5f62c86b50f21ef14ffda1112a8cd002e87590ca.zip |
Merge pull request #6148 from twinturbo/head-fix
Make ActionController#head pass rack-link
Diffstat (limited to 'actionpack/test/controller/new_base')
-rw-r--r-- | actionpack/test/controller/new_base/bare_metal_test.rb | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/actionpack/test/controller/new_base/bare_metal_test.rb b/actionpack/test/controller/new_base/bare_metal_test.rb index c424dcbd8d..5bcd79ebec 100644 --- a/actionpack/test/controller/new_base/bare_metal_test.rb +++ b/actionpack/test/controller/new_base/bare_metal_test.rb @@ -37,6 +37,36 @@ module BareMetalTest def index head :not_found end + + def continue + self.content_type = "text/html" + head 100 + end + + def switching_protocols + self.content_type = "text/html" + head 101 + end + + def processing + self.content_type = "text/html" + head 102 + end + + def no_content + self.content_type = "text/html" + head 204 + end + + def reset_content + self.content_type = "text/html" + head 205 + end + + def not_modified + self.content_type = "text/html" + head 304 + end end class HeadTest < ActiveSupport::TestCase @@ -44,6 +74,42 @@ module BareMetalTest status = HeadController.action(:index).call(Rack::MockRequest.env_for("/")).first assert_equal 404, status end + + test "head :continue (100) does not return a content-type header" do + headers = HeadController.action(:continue).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end + + test "head :continue (101) does not return a content-type header" do + headers = HeadController.action(:continue).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end + + test "head :processing (102) does not return a content-type header" do + headers = HeadController.action(:processing).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end + + test "head :no_content (204) does not return a content-type header" do + headers = HeadController.action(:no_content).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end + + test "head :reset_content (205) does not return a content-type header" do + headers = HeadController.action(:reset_content).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end + + test "head :not_modified (304) does not return a content-type header" do + headers = HeadController.action(:not_modified).call(Rack::MockRequest.env_for("/")).second + assert_nil headers['Content-Type'] + assert_nil headers['Content-Length'] + end end class BareControllerTest < ActionController::TestCase |