开发者

How to emulate a HTML multiselect of inputs in Ruby tests

开发者 https://www.devze.com 2023-02-24 03:50 出处:网络
How can you input multiple values for the one field into a开发者_运维知识库 Ruby functional test, much like a multiselect box?Code below that I thought would work, doesn\'t.

How can you input multiple values for the one field into a开发者_运维知识库 Ruby functional test, much like a multiselect box? Code below that I thought would work, doesn't.

post :create, :post => { :multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] }


unless you were really trying to post "post[multiselect1][]" and "post[multiselect2][]" you should try this:

post :create, {:multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] }

this will submit "multiselect1[]" and "multiselect2[]"

let me know if my assumption was wrong

cheers!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号