[rspec-users] Presentation Testing and CSS ids

Phlip phlip2005 at gmail.com
Thu Mar 12 11:11:52 EDT 2009

James Byrne wrote:

> As a side issue, in getting the input box ids to work with label ids as 
> I specified in the templates, I discovered that I had misread the 
> FormHelper api.  I uncovered my mistake by writing a few tests to 
> exercise this feature as Rails own test/form_helper_test.rb did not.
> The point is that I have submitted these tests as a patch to Rails and 
> they are awaiting verification for inclusion.  Patches require three 
> reviewers for consideration by the core team.  My submission has had one 
> positive review already. I would appreciate a couple of more. The 
> lighthouse ticket is 2096.

That reminds me of form_test_helper...

The deal is, with Rails out-of-the-box, you can test that a page wrote a form 
correctly, and the next text can show the post processes the arguments correctly...

...but the test cannot show the form contained the correct fields. You could 
mis-name a field, mis-name it in the first test, name it correctly in the next 
test, and all tests would pass.

form_test_helper scrapes your @response.body, finds a target form, and then 
posts it. It would catch the mis-named field situation.

Can webrat close that gap? Can Rails integration tests close that gap?


More information about the rspec-users mailing list