Test for repeated parameters
authorMartin Sarsale <martin@sumavisos.com>
Thu, 1 Dec 2011 14:04:40 +0000 (11:04 -0300)
committerMartin Sarsale <martin@sumavisos.com>
Thu, 1 Dec 2011 14:04:40 +0000 (11:04 -0300)
spec/google/api_client/discovery_spec.rb

index d0e38e4dba53782b634d36bcddcbf387a9807fce..6d0711abe329aecb3e50cbbdf1d01331146ec703 100644 (file)
@@ -174,7 +174,16 @@ describe Google::APIClient do
       (headers.inject({}) { |h,(k,v)| h[k]=v; h }).should == {}
       body.should respond_to(:each)
     end
-
+    it 'should generate valid requests when repeated parameters are passed' do
+      request = @client.generate_request(
+        :api_method => @prediction.training.insert,
+        :parameters => [['data', '1'],['data','2']]
+      )
+      method, uri, headers, body = request
+      method.should == 'POST'
+      uri.should ==
+        'https://www.googleapis.com/prediction/v1.2/training?data=1&data=2'
+    end
     it 'should generate requests against the correct URIs' do
       request = @client.generate_request(
         :api_method => @prediction.training.insert,