How to check a checkbox in capybara?

前端 未结 13 1937
灰色年华
灰色年华 2020-11-30 23:34

I\'m using Rspec and Capybara.

How can I write a step to check a checkbox? I\'ve tried check by value but it can\'t find my checkbox<

13条回答
  •  清歌不尽
    2020-12-01 00:03

    You can also check that all the checkboxes are not checked with this example.

    all('input[type=checkbox]').each do |checkbox| checkbox.should_not be_checked end

提交回复
热议问题