Nested assert_selects Bug in Edge?

I just noticed that the shortcut mentioned in the Rails Edge API documentation doesn't seem to actually work as specified; the nested selector doesn't seem to be restricted to one of the returned elements.

Example:

<ol id="fruit_basket">   <li><p class="type"></p></li>   <li><p class="type"></p></li>   <li><p class="type"></p></li>   <li><p class="type"></p></li> </ol>

Okay, standard ordered list with four list items, within each item is a p with class="apple".

According to the documentation, this should work:

assert_select "ol#fruit_basket>li" do   assert_select "p.type", 1 end

This fails with "Expected at most 1 elements, found 4.

If I do it explicitly,

assert_select "ol#fruit_basket>li" do |fruits|   fruits.each do |fruit|     assert_select fruit, "p.type", 1   end end

It passes.

Is this a core bug, or a documentation bug? If indeed this is a bug, and I'm not just nuts, I'd be happy to work on a patch for either.

Cheers, Trey

I guess its somewhat misleading documentation

As I understand it

      assert_select "ol>li" do |elements|           elements.each do |element|              assert_select element, "li"           end       end

says "For each li element that is a child of ol, assert that the element is a li "

whereas

      assert_select "ol>li" do            assert_select "li"       end

says "For the set of li elements that are children of ol, assert that the set contains an li element"

The second form is more useful then, if you had something like

<ol id="fruit_basket">   <li><p class="apple"></p></li>   <li><p class="pear"></p></li>   <li><p class="grape"></p></li>   <li><p class="orange"></p></li> </ol>

and you want to be able to implement "assert that the fruit basket contains an apple"