aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_json_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/render_json_test.rb')
-rw-r--r--actionpack/test/controller/render_json_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb
index 82c6aaafe5..0045d2be34 100644
--- a/actionpack/test/controller/render_json_test.rb
+++ b/actionpack/test/controller/render_json_test.rb
@@ -133,4 +133,22 @@ class RenderJsonTest < ActionController::TestCase
get :render_json_without_options
assert_equal '{"a":"b"}', @response.body
end
+
+ def test_should_not_trigger_content_type_deprecation
+ original = ActionDispatch::Response.return_only_media_type_on_content_type
+ ActionDispatch::Response.return_only_media_type_on_content_type = true
+
+ assert_not_deprecated { get :render_json_hello_world }
+ ensure
+ ActionDispatch::Response.return_only_media_type_on_content_type = original
+ end
+
+ def test_should_not_trigger_content_type_deprecation_with_callback
+ original = ActionDispatch::Response.return_only_media_type_on_content_type
+ ActionDispatch::Response.return_only_media_type_on_content_type = true
+
+ assert_not_deprecated { get :render_json_hello_world_with_callback, xhr: true }
+ ensure
+ ActionDispatch::Response.return_only_media_type_on_content_type = original
+ end
end