diff options
Diffstat (limited to 'actionpack/test/controller/test_case_test.rb')
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index e66c409786..663832e9bb 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -220,7 +220,15 @@ XML params = Hash[:page, { name: "page name" }, "some key", 123] post :render_raw_post, params: params.dup - assert_equal params.to_query, @response.body + assert_equal Rack::Utils.build_nested_query(params), @response.body + end + + def test_params_round_trip + params = { "foo" => { "contents" => [{ "name" => "gorby", "id" => "123" }, { "name" => "puff", "d" => "true" }] } } + post :test_params, params: params.dup + + controller_info = { "controller" => "test_case_test/test", "action" => "test_params" } + assert_equal params.merge(controller_info), JSON.parse(@response.body) end def test_body_stream @@ -228,7 +236,7 @@ XML post :render_body, params: params.dup - assert_equal params.to_query, @response.body + assert_equal Rack::Utils.build_nested_query(params), @response.body end def test_document_body_and_params_with_post @@ -689,6 +697,14 @@ XML assert_equal "foo=baz", @request.raw_post end + def test_content_length_reset_after_post_request + post :no_op, params: { foo: "bar" } + assert_not_equal 0, @request.content_length + + get :no_op + assert_equal 0, @request.content_length + end + def test_path_is_kept_after_the_request get :test_params, params: { id: "foo" } assert_equal "/test_case_test/test/test_params/foo", @request.path |