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

2009-03-15 Thread Phlip
Pat Maddox wrote: I dunno. Zach's original attempt hardly "sucks". That was David Chelimsky's attempt - Zach seconded it. But I was replying to myself. More important, the tie-breaker here is very simple: When the assertion fails, can it tell you exactly how to fix things? That me

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

2009-03-15 Thread Pat Maddox
On Mar 15, 2009, at 10:33 AM, Zach Dennis wrote: On Sun, Mar 15, 2009 at 1:05 PM, Phlip wrote: response.body.should be_html_with{ form :action => '/users' do fieldset do legend 'Personal Information' label 'First name' input :type => 'text', :name => 'user[

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

2009-03-15 Thread Phlip
Zach Dennis wrote: I didn't have the expectation that they were peers of each other, just that they both existed somewhere in a fieldset tag. Any helper or matchers used for spec'ing views should be as liberal as possible while still communicating enough about the semantics of the page for the e

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

2009-03-15 Thread Zach Dennis
On Sun, Mar 15, 2009 at 1:05 PM, Phlip wrote: >>>   response.body.should be_html_with{ >>>     form :action => '/users' do >>>       fieldset do >>>         legend 'Personal Information' >>>         label 'First name' >>>         input :type => 'text', :name => 'user[first_name]' >>>       end >>>

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

2009-03-15 Thread Phlip
response.body.should be_html_with{ form :action => '/users' do fieldset do legend 'Personal Information' label 'First name' input :type => 'text', :name => 'user[first_name]' end end } Has anyone tried this? is it useful? That assertion

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

2009-03-09 Thread Phlip
I haven't tried it yet, but it does seem very useful. The project I'm focused on right now is all json all the time, so I don't personally have a real world case for this at the moment. Anybody doing an app w/ html views willing to try this out? I put it into my current project today (as a >coug

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

2009-03-09 Thread Phlip
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 ov

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

2009-03-09 Thread David Chelimsky
On Mon, Mar 9, 2009 at 6:49 PM, 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. What is the method name was be_html_including instead of be_html_w

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

2009-03-09 Thread Pat Nakajima
> > 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. On Mon, Mar 9, 2009 at 7:20 PM, Phlip wrote: > http://gist.github.com/76136 >> > > response.body.should be_html_wit

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

2009-03-09 Thread David Chelimsky
On Mon, Mar 9, 2009 at 6:20 PM, Phlip wrote: >> http://gist.github.com/76136 > >>    response.body.should be_html_with{ >>      form :action => '/users' do >>        fieldset do >>          legend 'Personal Information' >>          label 'First name' >>          input :type => 'text', :name => 'us

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

2009-03-09 Thread Phlip
http://gist.github.com/76136 response.body.should be_html_with{ form :action => '/users' do fieldset do legend 'Personal Information' label 'First name' input :type => 'text', :name => 'user[first_name]' end end } Has anyone tr

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

2009-03-09 Thread Phlip
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. Boom: http://gist