From 6e842f216c52d23f33a19a18cff7db14fe3787fc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 4 Aug 2006 00:15:09 +0000 Subject: Make us pass to ease RESTful children posts git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4658 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/cgi_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test/controller/cgi_test.rb') diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index f0af5b4ed3..9e5aa9f92f 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -34,6 +34,17 @@ class CGITest < Test::Unit::TestCase assert_equal({'x' => {'y' => {'z' => ['10']}}}, CGIMethods.parse_query_parameters('x[y][z][]=10')) assert_equal({'x' => {'y' => {'z' => ['10', '5']}}}, CGIMethods.parse_query_parameters('x[y][z][]=10&x[y][z][]=5')) end + + def test_deep_query_string_with_array_of_hashes_with_one_pair + assert_equal({'x' => {'y' => [{'z' => '10'}, {'z' => '20'}]}}, CGIMethods.parse_query_parameters('x[y][][z]=10&x[y][][z]=20')) + end + + def test_deep_query_string_with_array_of_hashes_with_multiple_pairs + assert_equal( + {'x' => {'y' => [{'z' => '10', 'w' => 'a'}, {'z' => '20', 'w' => 'b'}]}}, + CGIMethods.parse_query_parameters('x[y][][z]=10&x[y][][w]=a&x[y][][z]=20&x[y][][w]=c') + ) + end def test_query_string_with_nil assert_equal( -- cgit v1.2.3