sporkmonger/addressable — pull request #84 by mariochavez (2012-08-07 18:25:07+00:00)
Title: Added support for nested hashes

Without this Weary can't be upgraded to latest addressable gem version

So now we can pass to query_values a hash like:
{:public=>true, :files=>{"file1.txt"=>{:content=>"String file contents"}}}

And get it converted to:
{"public"=>true, "files[file1.txt][content]"=>"String file contents"}

Which query_params will finally convert to:
["flag1=value1", "flag2%5Bflag3%5D%5Bflag4%5D=value2"] or ["flag1=value1", "flag2[flag3][flag4]=value2"]

But this change broke the following tests where the hashes have become valid:
1) Addressable::URI when assigning query values should raise an error attempting to assign {'a' => {'b' => ['c']}}
Failure/Error: (lambda do
expected TypeError but nothing was raised
# ./spec/addressable/uri_spec.rb:4925:in `block (2 levels) in '

2) Addressable::URI when assigning query values should raise an error attempting to assign {:b => '2', :a => {:c => '1'}}
Failure/Error: (lambda do
expected TypeError but nothing was raised
# ./spec/addressable/uri_spec.rb:4932:in `block (2 levels) in '

3) Addressable::URI when assigning query values should raise an error attempting to assign {:a => 'a', :b => {:c => true, :d => 'd'}}
Failure/Error: (lambda do
expected TypeError but nothing was raised
# ./spec/addressable/uri_spec.rb:4959:in `block (2 levels) in '

4) Addressable::URI when assigning query values should raise an error attempting to assign {:a => 'a', :b => {:c => true, :d => 'd'}}
Failure/Error: (lambda do
expected TypeError but nothing was raised
# ./spec/addressable/uri_spec.rb:4968:in `block (2 levels) in '

{"a"=>{"b"=>["c"]}} => {"a[b]"=>["c"]}
{:b => '2', :a => {:c => '1'}} => {"b"=>"2", "a[c]"=>"1"}
{:a=>"a", :b=>{:c=>true, :d=>"d"}} => {"a"=>"a", "b[c]"=>true, "b[d]"=>"d"}
{:a => 'a', :b => {:c => true, :d => 'd'}} => {"a"=>"a", "b[c]"=>true, "b[d]"=>"d"}

Please advice if this patch is ok and if I should just delete failed tests since their test cases are not valid anymore with this patch.