diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-06-07 20:46:27 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-06-07 20:46:27 +0200 |
commit | af2b7459090f108bdfe662618792f423c347d8ac (patch) | |
tree | 2f109e28d49e0af217877341740394d9015f10fa /actionpack/test | |
parent | a4154d8efbc4921b48866cac8fd3cf5550ed9e78 (diff) | |
download | rails-af2b7459090f108bdfe662618792f423c347d8ac.tar.gz rails-af2b7459090f108bdfe662618792f423c347d8ac.tar.bz2 rails-af2b7459090f108bdfe662618792f423c347d8ac.zip |
Add regression test to `as` option.
Was worried the `as` might impede on users doing the long form
JSON response encoding; test for certainty.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
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 |