Rails, rspec, post array, like "hey [] = 1"

I need to check if the POINTS client includes an array in post-request. When I test it with the RESTClient plugin for firefox, I do it like this:

POINTS[]=1.111111,2.222222,77

and it works. Now I need to test it with rspec, but I cannot figure out how to do this. Here is my rspec test request:

post :event, DISTANCE: "12345", POINTS: { "1" => "1.111111,2.222222,77" }

But for some reason this does not work. puts p.inspect shows: ["1", "1.111111,2.222222,77"], and this is not what I want.

Thank.

+3
source share
1 answer

As already mentioned in the comments, do:

post :event, distance: "12345", points:  ["1.111111,2.222222,77"]
+1
source

All Articles