test/form_post_test.rb in faraday-0.5.2 vs test/form_post_test.rb in faraday-0.5.3
- old
+ new
@@ -37,6 +37,22 @@
def test_processes_string_body
@env[:body] = 'abc'
@app.process_body_for_request @env
assert_equal 'abc', @env[:body]
end
+
+ def test_processes_array_values
+ @env[:body] = {:a => [:b, 1]}
+ @app.process_body_for_request @env
+ assert_equal 'a[]=b&a[]=1', @env[:body]
+ end
+
+ def test_processes_nested_array_values
+ @env[:body] = {:a => [:b, {:c => :d}, [:e]]}
+ @app.process_body_for_request @env
+
+ # a[]=b&a[][c]=d&a[][]=e
+ assert_match /a\[\]=b/, @env[:body]
+ assert_match /a\[\]\[c\]=d/, @env[:body]
+ assert_match /a\[\]\[\]=e/, @env[:body]
+ end
end