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

Edward Ocampo-Gooding edward.og at gmail.com
Sun Jul 22 11:10:12 EDT 2007

Hans de Graaff wrote:
> 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.

Right on. Thanks Hans.

More information about the rspec-users mailing list