开发者

How to emulate a HTML multiselect of inputs in Ruby tests

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜