[rspec-users] response.body.should be_xml_with -- how to do nested xpath matches

Phlip phlip2005 at gmail.com
Sun Mar 8 16:14:19 EDT 2009


Zach Dennis wrote:

>> response.body.should be_xml_with do
>>  form :action => '/users' do
>>    fieldset do
>>      legend "Personal Information"
>>      label "First name"
>>      input :type => 'text', :name => 'user[first_name]'
>>    end
>>  end
>> end

> I like this a lot.

I just thought of about 3 truly sick ways to do that.

Let me write them up, and then we will resume this thread.

I expect to also throw in Strict XHTML compliance checking as an option. <a> 
cannot be around <div>, etc; stuff like that. (Or whatever those rules are!)

If I were evil, I would also permit :type => /e/, for those who want any type 
with an /e/ in it!

-- 
   Phlip
   http://www.zeroplayer.com/



More information about the rspec-users mailing list