[rspec-users] [RSpec] matcher for href
Jarkko Laine
jarkko at jlaine.net
Mon Jan 19 14:26:51 EST 2009
On 19.1.2009, at 21.11, James Byrne wrote:
> Of the several ways available to test for this, what would be the
> preferred way to see if the following is present in an html document
> WITHOUT actually following the link?
>
> <a href="/users/new">
>
> I tried this:
>
> response.body.should have_text('href="/users/new"')
response.should have_tag("a[href=/users/new]")
http://rspec.rubyforge.org/rspec-rails/1.1.12/classes/Spec/Rails/Matchers.html#M000071
//jarkko
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://odesign.fi
Check out my latest book, Unobtrusive Prototype, fresh off the
Peepcode oven:
http://peepcode.com/products/unobtrusive-prototype-js
More information about the rspec-users
mailing list