summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Conzett <gconzett@covermymeds.com>2016-02-12 15:21:12 -0500
committerRyan T. Hosford <tad.hosford@gmail.com>2016-03-04 18:19:08 -0600
commitb1bf5a35409a3c6da2f1b7c2e1e41c9b842c0fe7 (patch)
tree353c6ab084917432d815a35dcaeb89b11ee08dca
parent7f00781a7b9c75ddb86d0ab52132885ee88d5bac (diff)
downloadrack-b1bf5a35409a3c6da2f1b7c2e1e41c9b842c0fe7.tar.gz
Add more failing specs for ararys
-rw-r--r--test/spec_utils.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/spec_utils.rb b/test/spec_utils.rb
index 6750932f..9601cbaf 100644
--- a/test/spec_utils.rb
+++ b/test/spec_utils.rb
@@ -305,13 +305,15 @@ describe Rack::Utils do
       must_equal 'x[y][][z]=1&x[y][][z]=2'
     Rack::Utils.build_nested_query('x' => { 'y' => [{ 'z' => '1', 'w' => 'a' }, { 'z' => '2', 'w' => '3' }] }).
       must_equal 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3'
+    Rack::Utils.build_nested_query({"foo" => ["1", ["2"]]}).
+      must_equal 'foo[]=1&foo[][]=2'
 
     lambda { Rack::Utils.build_nested_query("foo=bar") }.
       must_raise(ArgumentError).
       message.must_equal "value must be a Hash"
   end
 
-  it 'perform the inverse function of #parse_nested_query' do
+  it 'performs the inverse function of #parse_nested_query' do
     [{"foo" => nil, "bar" => ""},
       {"foo" => "bar", "baz" => ""},
       {"foo" => ["1", "2"]},
@@ -328,7 +330,8 @@ describe Rack::Utils do
       {"x" => {"y" => [{"v" => {"w" => "1"}}]}},
       {"x" => {"y" => [{"z" => "1", "v" => {"w" => "2"}}]}},
       {"x" => {"y" => [{"z" => "1"}, {"z" => "2"}]}},
-      {"x" => {"y" => [{"z" => "1", "w" => "a"}, {"z" => "2", "w" => "3"}]}}
+      {"x" => {"y" => [{"z" => "1", "w" => "a"}, {"z" => "2", "w" => "3"}]}},
+      {"foo" => ["1", ["2"]]},
     ].each { |params|
       qs = Rack::Utils.build_nested_query(params)
       Rack::Utils.parse_nested_query(qs).must_equal params