aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorGaurav Sharma <gaurav2728@gmail.com>2015-10-02 01:27:23 +0530
committerGaurav Sharma <gaurav2728@gmail.com>2015-10-02 01:27:23 +0530
commitd87427c6c75c4d8573ea77a7447c6ab1a3dcde9d (patch)
tree45a2a8514faed066ee9f65e62298c3cfa6f5f4c8 /actionpack/test
parent62c82f7ddf0b50aae98a13236bc3ab88c3942d4d (diff)
downloadrails-d87427c6c75c4d8573ea77a7447c6ab1a3dcde9d.tar.gz
rails-d87427c6c75c4d8573ea77a7447c6ab1a3dcde9d.tar.bz2
rails-d87427c6c75c4d8573ea77a7447c6ab1a3dcde9d.zip
adding test for content type with default charset
* first test is for `default_charset` i.e `ActionDispatch::Response.default_charset = “utf-8”` * In below test we are passing `ActionDispatch::Response.default_charset = 'utf-16’` so name of the test is irrelevant — “read content type without charset”
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/response_test.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 85cdcda655..fa29f3a6c4 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -196,7 +196,17 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal('application/xml; charset=utf-16', resp.headers['Content-Type'])
end
- test "read content type without charset" do
+ test "read content type with default charset utf-8" do
+ original = ActionDispatch::Response.default_charset
+ begin
+ resp = ActionDispatch::Response.new(200, { "Content-Type" => "text/xml" })
+ assert_equal('utf-8', resp.charset)
+ ensure
+ ActionDispatch::Response.default_charset = original
+ end
+ end
+
+ test "read content type with charset utf-16" do
jruby_skip "https://github.com/jruby/jruby/issues/3138"
original = ActionDispatch::Response.default_charset