This could be useful to someone searching the Interwebs for a solution. Hopefully it will save someone some time, as it took some time to figure it out. Looking back, I can see where someone might find it obvious. I didn’t, for some reason.
The following is how I accomplished it, using a CSS selector:
1 2 3
This requires that the checkbox
input elements have a unique
attribute. You might, having some knowledge of Capybara’s
class, think that you can just use
#path, which returns an elements
XPath string, in place of
[:id]. That’s what I thought, and I welcome
you to try it — what kind of hackers would we be if we believed it every
time someone said something wasn’t possible? I, unfortunately, was
unable to make it work. The
check method reported that it could not
find an element with said
path (or XPath).
I’d love to hear it if you have better luck!