rspec-html

0.3.5
Light Mode Dark Mode

be_checked

Use the be_checked matcher to verify that a checkbox input is checked.

subject(:document) do
  parse_html('<form><input type="checkbox" checked></form>')
end

it 'renders a checked checkbox input' do
  expect(document.form.input(type: 'checkbox')).to be_checked
end
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
    <form><input type="checkbox" checked></form>
  </body></html>

Documentation generated by rspec-documentation