def test_checkbox_checked
expected = "<input checked=\"checked\" type=\"checkbox\" value=\"true\" name=\"1\"><input type=\"hidden\" value=\"false\" name=\"1\">"
output = render do |r|
r.checkbox(true) do end
end
assert_match(/y><input/, output, "Is an input element")
assert_match(/y><[^>]+type="checkbox"/, output, "Is a checkbox")
assert_match(/y><[^>]+value="true"/, output, "Is set to true")
assert_match(/y><[^>]+name="1"/, output, "Has a name")
assert_match(/"><input/, output, "Has a second hidden input")
assert_match(/"><[^>]+type="hidden"/, output, "Second input is hidden")
assert_match(/"><[^>]+value="false"/, output,
"Second input is set to false")
assert_match(/"><[^>]+name="1"/, output,
"Second input has a name with the same value as the first")
end