aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
authorKunal Shah <me@kunalashah.com>2012-05-07 15:23:06 -0400
committerKunal Shah <me@kunalashah.com>2012-05-07 15:23:06 -0400
commit6f383482654fe071faaf3bafbadde2eb5bc091fd (patch)
tree2c6d16288bff8b955198d34b522dcb663733ec7c /actionpack/test/controller/render_test.rb
parent7fb268d8dd203cb8e398f18d92d55037ba31cab0 (diff)
downloadrails-6f383482654fe071faaf3bafbadde2eb5bc091fd.tar.gz
rails-6f383482654fe071faaf3bafbadde2eb5bc091fd.tar.bz2
rails-6f383482654fe071faaf3bafbadde2eb5bc091fd.zip
Add failing test re #3436 which demonstrates content_type is not respected when using the :head method/shortcut
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 85abf3248d..b4ef22ecf7 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -495,6 +495,14 @@ class TestController < ActionController::Base
render :text => "hello world!"
end
+ def head_created
+ head :created
+ end
+
+ def head_created_with_application_json_content_type
+ head :created, :content_type => "application/json"
+ end
+
def head_with_location_header
head :location => "/foo"
end
@@ -1172,6 +1180,19 @@ class RenderTest < ActionController::TestCase
assert_equal "<html>\n <p>Hello</p>\n</html>\n", @response.body
end
+ def test_head_created
+ post :head_created
+ assert_blank @response.body
+ assert_response :created
+ end
+
+ def test_head_created_with_application_json_content_type
+ post :head_created_with_application_json_content_type
+ assert_blank @response.body
+ assert_equal "application/json", @response.content_type
+ assert_response :created
+ end
+
def test_head_with_location_header
get :head_with_location_header
assert_blank @response.body