[rspec-users] how to write nested XPath matchers

Phlip phlip2005 at gmail.com
Mon Feb 16 21:40:18 EST 2009


> The same error message for a stray nil:

This attempt, calling simple_matcher directly, gives nearly the same nil:

   def be_xml_with_(&block)
     waz_xdoc = @xdoc
     simple_matcher 'yo' do |given, matcher|
       wrap_expectation matcher do
         assert_xhtml given  #  this works
         block.call  #  crashes with a nil.first error!
       end
     end
   ensure
     @xdoc = waz_xdoc
   end

   it 'should have xpathic tags' do
     render '/users/new'

     response.body.should be_xml_with{  #  error points to this line
       xpath :form, :action => '/users'

So why no stack trace so I can diagnose this?



More information about the rspec-users mailing list