On 25 Nov 2008, at 02:23, Andrew Premdas wrote:

You definitely should have an id for your output. One of the really
good things about feature testing is that it helps you identify what
needs to be seen in your output, and by that I don't mean specific
text, but rather a semantic meaning of your output, in this case a
project containing a token. You should be using css id's and/or
classes to identify these things.

This will help you write less brittle features that don't depend on
the content of something, or even worse the label describing it.

+1

The person I often sit down to pair with on features is our CSS / markup hacker. You can write really nice features if you work to make them meaningful within the context of the markup (and make the markup meaningful within the context of the feature).

As well as #assert_select, check out the #within method that webrat gives you - you can use it to scope queries against the DOM of the response down to part of the page.

Also I'd suggest looking at using Hpricot for validating the response - it's used internally by webrat and is a really nice API for walking the HTML produced by the response.

cheers,
Matt
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to