aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2012-12-30 22:49:46 +0100
committerYves Senn <yves.senn@gmail.com>2012-12-31 17:04:51 +0100
commit55a886b6e9bae1986a357626b08522a838aedb3e (patch)
treefd53e7bbfd00af4ff8fbc82be958de539c247d9e /actionpack/test/controller/render_test.rb
parentd38c8caa48a732d41c7402a5e71deece4e313559 (diff)
downloadrails-55a886b6e9bae1986a357626b08522a838aedb3e.tar.gz
rails-55a886b6e9bae1986a357626b08522a838aedb3e.tar.bz2
rails-55a886b6e9bae1986a357626b08522a838aedb3e.zip
backport #8662, charset should not be appended for `head` responses
1) Failure: test_head_created_with_image_png_content_type(RenderTest) [test/controller/render_test.rb:1238]: Expected: "image/png" Actual: "image/png; charset=utf-8"
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 8c631e218f..be5d25a436 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -503,6 +503,10 @@ class TestController < ActionController::Base
head :created, :content_type => "application/json"
end
+ def head_ok_with_image_png_content_type
+ head :ok, :content_type => "image/png"
+ end
+
def head_with_location_header
head :location => "/foo"
end
@@ -1197,10 +1201,17 @@ class RenderTest < ActionController::TestCase
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_equal "application/json", @response.header["Content-Type"]
assert_response :created
end
+ def test_head_ok_with_image_png_content_type
+ post :head_ok_with_image_png_content_type
+ assert_blank @response.body
+ assert_equal "image/png", @response.header["Content-Type"]
+ assert_response :ok
+ end
+
def test_head_with_location_header
get :head_with_location_header
assert_blank @response.body