aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-13 11:06:20 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-13 11:06:20 -0300
commitcf5ec92a8b8b8d11f4fa017acc4246de4a4d95fe (patch)
tree17e1004fa44d95119eaeeb075c4a861290374104 /actionpack
parent03148ec96ca7c0f2d461aa242b585e81fe2221d7 (diff)
parentd5efb1f9bdbd6c0392ea2c0aeaa3e61691683685 (diff)
downloadrails-cf5ec92a8b8b8d11f4fa017acc4246de4a4d95fe.tar.gz
rails-cf5ec92a8b8b8d11f4fa017acc4246de4a4d95fe.tar.bz2
rails-cf5ec92a8b8b8d11f4fa017acc4246de4a4d95fe.zip
Merge pull request #19291 from hired/return-truthy-value-from-head
Return truthy value from head method
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