views:

46

answers:

0

How do I use Webrat to check that a select box has certain values listed as options? I currently have field_named(field).value.should contain(value) but that only passes for the first selected value and not for the unselected values. How do I check that the unselected options are present? And how do I check the number of options available in a select box?

I believe I need something akin to field_named(field).element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{value}/ except that I don't actually care about what's selected - only what exists.

Can you also provide a source on where your answer comes from? I find documentation on using Webrat beyond the basics terribly difficult to find.