[rspec-users] custom, nested HTML matchers in RSpec

Phlip phlip2005 at gmail.com
Mon Mar 9 21:52:03 EDT 2009

Pat Nakajima wrote:

>     Has anyone tried this? is it useful?

> It looks interesting, though it could be confused for trying to exactly 
> mimic the actual markup, not just specify interesting parts.

It only specifies interesting parts. The gist writeup explained that, for 
example, it skipped over intermediate <ol><li> tags. And it naturally skips 
blanks in contents, and unlisted attributes.

It is exactly the same as the XPath version I posted before. That used explicit 
XPath queries to skip over uninteresting parts.

David Chelimsky wrote:

 > What is the method name was be_html_including instead of be_html_with???

('be_html_including'.length - 'be_html_with'.length) / 17 =~ 30%.

So 30% fewer people would bother to type it!

More information about the rspec-users mailing list