From d5efb1f9bdbd6c0392ea2c0aeaa3e61691683685 Mon Sep 17 00:00:00 2001 From: Joel Hayhurst Date: Wed, 11 Mar 2015 11:31:14 -0700 Subject: Return true from head method It was returning false in normal circumstances. This broke the `head :ok and return if` construct. Add appropriate test. --- actionpack/lib/action_controller/metal/head.rb | 2 ++ actionpack/test/controller/render_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index 0d93e2f7aa..70f42bf565 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -38,6 +38,8 @@ module ActionController headers.delete('Content-Type') headers.delete('Content-Length') end + + true end private diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 488585c7a4..79e2104789 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -173,6 +173,11 @@ class TestController < ActionController::Base head :forbidden, :x_custom_header => "something" end + def head_and_return + head :ok and return + raise 'should not reach this line' + end + def head_with_no_content # Fill in the headers with dummy data to make # sure they get removed during the testing @@ -560,6 +565,12 @@ class HeadRenderTest < ActionController::TestCase assert_equal "something", @response.headers["X-Custom-Header"] assert_response :forbidden end + + def test_head_returns_truthy_value + assert_nothing_raised do + get :head_and_return + end + end end class HttpCacheForeverTest < ActionController::TestCase -- cgit v1.2.3