aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorMarcin Olichwirowicz <olichwirowicz@gmail.com>2015-08-15 20:18:39 +0200
committerMarcin Olichwirowicz <olichwirowicz@gmail.com>2015-08-21 09:31:18 +0200
commit36e53fca785afcc83a9879fe5a3997281d567f8a (patch)
treec5ee6ab0a879a7a45f3bc1e08e95fc6e1131cfff /actionpack
parentacb2b07ebdfcf8f683b90a0e5de0558ae0f20259 (diff)
downloadrails-36e53fca785afcc83a9879fe5a3997281d567f8a.tar.gz
rails-36e53fca785afcc83a9879fe5a3997281d567f8a.tar.bz2
rails-36e53fca785afcc83a9879fe5a3997281d567f8a.zip
Add test for parsing application/vnd.api+json
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/dispatch/request/json_params_parsing_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb
index c2300a0142..28ebaed663 100644
--- a/actionpack/test/dispatch/request/json_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb
@@ -37,6 +37,13 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest
)
end
+ test "parses json params for application/vnd.api+json" do
+ assert_parses(
+ {"person" => {"name" => "David"}},
+ "{\"person\": {\"name\": \"David\"}}", { 'CONTENT_TYPE' => 'application/vnd.api+json' }
+ )
+ end
+
test "nils are stripped from collections" do
assert_parses(
{"person" => []},
@@ -136,6 +143,13 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest
)
end
+ test "parses json params for application/vnd.api+json" do
+ assert_parses(
+ {"user" => {"username" => "sikachu"}, "username" => "sikachu"},
+ "{\"username\": \"sikachu\"}", { 'CONTENT_TYPE' => 'application/vnd.api+json' }
+ )
+ end
+
test "parses json with non-object JSON content" do
assert_parses(
{"user" => {"_json" => "string content" }, "_json" => "string content" },