From af2b7459090f108bdfe662618792f423c347d8ac Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Tue, 7 Jun 2016 20:46:27 +0200 Subject: Add regression test to `as` option. Was worried the `as` might impede on users doing the long form JSON response encoding; test for certainty. --- actionpack/test/controller/integration_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'actionpack') diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 97571c1308..34fb3b1003 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -1147,6 +1147,22 @@ class IntegrationRequestEncodersTest < ActionDispatch::IntegrationTest end end + def test_standard_json_encoding_works + with_routing do |routes| + routes.draw do + ActiveSupport::Deprecation.silence do + post ':action' => FooController + end + end + + post '/foos_json.json', params: { foo: 'fighters' }.to_json, + headers: { 'Content-Type' => 'application/json' } + + assert_response :success + assert_equal({ 'foo' => 'fighters' }, response.parsed_body) + end + end + def test_encoding_as_json post_to_foos as: :json do assert_response :success -- cgit v1.2.3