The within
method is used for scoping where to look for an element. For example, you might want to only look for the radio button in a certain div:
within(:css, '#some_parent_div') do
find(:css, '#rating_commute_8').should be_checked
end
In this case, assuming the radio button's id is unique, you do not need to define a specific search scope. You just need to find the element and then check if it is checked. To just find the element, you need to use find
instead of within
. The following should work:
find(:css, '#rating_commute_8').should be_checked