[rspec-users] Speccing the existance of an unchecked checkbox

Bart Zonneveld loop at superinfinite.com
Wed Sep 3 07:56:28 EDT 2008

Hey list,

I found myself trying to verify there are some non-checked checkboxes  
in a template today, and am kinda stumped how to do it :).
A checked checkbox is easy, have_tag('input[type=checkbox] 
[checked=checked]). But, an unchecked checkbox hasn't got the checked  
attribute at all. And as it so happens, I want to test for a number of  
checked, and a number of unchecked checkboxes. So, just testing for  
input[type=checkbox] would return the number of checked *and*  
unchecked checkboxes..

any ideas?
ps: that's prolly the most occurences of 'check' in a single email...

More information about the rspec-users mailing list