[rspec-users] Testing helpers that accept a block

Phlip phlip2005 at gmail.com
Wed Apr 8 23:53:34 EDT 2009

>         assert_xhtml output do
>           div.error do
>             p 'Block'
>           end
>         end

Nokogiri has some "easter eggs" in its ambitious HTML::Builder system. One of 
them is only HTML tags not already recognized as methods can get turned into 
HTML tags. The usual .method_missing() abuse.

The fix is:

         assert_xhtml output do
           div.error do
             p! 'Block'

(Also .be_html_with might work by now... 0.4.9?)

Aaron P. is pondering this issue even now in his subconscious, but I only ought 
to feed him one feature request at a time and a couple others are ahead in the 
queue, so my ! trick has to work for the near future...

More information about the rspec-users mailing list