[rspec-users] have_tag for href with specific link?

Hans de Graaff hans at degraaff.org
Sun Jul 22 03:05:00 EDT 2007

On Sun, 2007-07-22 at 03:00 -0400, Edward Ocampo-Gooding wrote:

> My question: I'm trying to specify that an index page should show a list 
> of things, each with a link to a delete action. How would my have_tag 
> (or whatever I should be using) look like?

have_tag just wraps assert_select from Rails, so you can use all its
goodness to select specific DOM elements. In your case something like
this should work:

  response.should have_tag('a[href^=/stuff/delete]')

The ^= matches the beginning of the argument. Check the assert_select
docs for all the possible ways to match DOM elements.

Kind regards,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070722/58e17cd8/attachment.bin 

More information about the rspec-users mailing list