From 630984797855a219b9c1dab9b026e0d3e751d0ef Mon Sep 17 00:00:00 2001 From: Dylan Leeman Date: Fri, 25 Mar 2016 09:14:39 -0500 Subject: [PATCH] Added nested array test --- spec/signature_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/signature_spec.rb b/spec/signature_spec.rb index ec15e79..96256cd 100644 --- a/spec/signature_spec.rb +++ b/spec/signature_spec.rb @@ -75,6 +75,15 @@ "POST\n/some/path\nthings[][thing_1]=value1&things[][thing_2]=value2" end + it "should generate correct string when query hash contains nested arrays" do + @request.query_hash = { + "things" => [{ "thing_1" => [["v1", "v1"]] }, { "thing_2" => [["v2", "v2"]] }] + } + @request.send(:string_to_sign).should == + "POST\n/some/path\nthings[][thing_1][][]=v1&things[][thing_1][][]=v1"\ + "&things[][thing_2][][]=v2&things[][thing_2][][]=v2" + end + # This may well change in auth version 2 it "should not escape keys or values in the query string" do @request.query_hash = {