diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-29 11:51:32 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-29 11:51:32 -0200 |
commit | a35ec0c02235e7e332f8551a6c94c69ac929a1bf (patch) | |
tree | 77235d82964272c8721a62ae046b16279d01f945 /actionpack/test/dispatch/request/json_params_parsing_test.rb | |
parent | 069b72aaf04d2caef76f8e71f320716129f2d949 (diff) | |
parent | baf14ae513337cb185acf865e93dfc48f3aabf6a (diff) | |
download | rails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.tar.gz rails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.tar.bz2 rails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.zip |
Merge pull request #18323 from kirs/controller-test-kwargs
Use kwargs in ActionController::TestCase and ActionDispatch::Integration HTTP methods
Diffstat (limited to 'actionpack/test/dispatch/request/json_params_parsing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/request/json_params_parsing_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index b765a13fa1..c7925fe0fa 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -56,7 +56,7 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest with_test_routing do output = StringIO.new json = "[\"person]\": {\"name\": \"David\"}}" - post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => ActiveSupport::Logger.new(output)} + post "/parse", params: json, headers: {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => ActiveSupport::Logger.new(output)} assert_response :bad_request output.rewind && err = output.read assert err =~ /Error occurred while parsing request parameters/ @@ -79,7 +79,7 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest test 'raw_post is not empty for JSON request' do with_test_routing do - post '/parse', '{"posts": [{"title": "Post Title"}]}', 'CONTENT_TYPE' => 'application/json' + post '/parse', params: '{"posts": [{"title": "Post Title"}]}', headers: { 'CONTENT_TYPE' => 'application/json' } assert_equal '{"posts": [{"title": "Post Title"}]}', request.raw_post end end @@ -87,7 +87,7 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest private def assert_parses(expected, actual, headers = {}) with_test_routing do - post "/parse", actual, headers + post "/parse", params: actual, headers: headers assert_response :ok assert_equal(expected, TestController.last_request_parameters) end @@ -146,7 +146,7 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest private def assert_parses(expected, actual, headers = {}) with_test_routing(UsersController) do - post "/parse", actual, headers + post "/parse", params: actual, headers: headers assert_response :ok assert_equal(expected, UsersController.last_request_parameters) assert_equal(expected.merge({"action" => "parse"}), UsersController.last_parameters) |