aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoel Hayhurst <joel@hired.com>2015-03-11 11:31:14 -0700
committerJoel Hayhurst <joel@hired.com>2015-03-12 14:39:22 -0700
commitd5efb1f9bdbd6c0392ea2c0aeaa3e61691683685 (patch)
tree431dbfc57526216c3c09d1713439b6de46b10293 /actionpack
parent1b7ae86f262df7d15b57be3b4a4f38680ce37c64 (diff)
downloadrails-d5efb1f9bdbd6c0392ea2c0aeaa3e61691683685.tar.gz
rails-d5efb1f9bdbd6c0392ea2c0aeaa3e61691683685.tar.bz2
rails-d5efb1f9bdbd6c0392ea2c0aeaa3e61691683685.zip
Return true from head method
It was returning false in normal circumstances. This broke the `head :ok and return if` construct. Add appropriate test.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/head.rb2
-rw-r--r--actionpack/test/controller/render_test.rb11
2 files changed, 13 insertions, 0 deletions
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