kucaahbe / rspec-html-matchers

Old school have_tag, with_tag(and more) matchers for rspec 3 (Nokogiri powered)
http://rubygems.org/gems/rspec-html-matchers
MIT License
199 stars 90 forks source link

have_tag("li", /Some Text/) #2

Closed jensb closed 13 years ago

jensb commented 13 years ago

This worked in the rspec1 version. Are you planning to implement matching text / a regexp / a substring which is contained within the named tag?

jensb commented 13 years ago

Also, have_tag("li.some_class", 3) == there must be exactly 3 such elements.

kucaahbe commented 13 years ago

all this already exist, but behavior little changed, look here for how it works, sorry, i had no time to make more user-friendly documentation..

jensb commented 13 years ago

I have looked into the source - thanks! Also, is there a way to combine matchers with "AND"? e.g.

have_tag("td", :text => /user_string/, :count => 2)

should return true when there are exactly 2 TD tags which contain "user_string". However, when there are more than 2 TD tags (with different content), have_tag counts all TD elements, not just the two with the right text, and then fails the test.

kucaahbe commented 13 years ago

Oh, I understood, for now options like :text and :count(and other) don't rely on each other but should, and this is a big bug, I'll try to fix this as soon as possible, thanks for pointing me on this

kucaahbe commented 13 years ago

fixed in 0.0.4

jensb commented 13 years ago

wow, thanks! I'll try it ASAP.