Help me refactor a step for finding href in specific link

I want to verify the href is correct:

Website

my step in the cucumber file:
And the “website” class should have “www.happyhour.com

the step definition:
Then /^the “([^"])" class should have "([^"])”$/ do |link, url|
response.should have_selector(“.#{link}”) do |site|
site.inner_html.include?(url).should be_true
end
end

it’s doesn’t look good and would like to hear suggestion for improving
it.
Thanks!

On Mar 31, 2010, at 5:13 PM, Oren G. wrote:

response.should have_selector(“.#{link}”) do |site|
site.inner_html.include?(url).should be_true
end
end

it’s doesn’t look good and would like to hear suggestion for improving
it.
Thanks!

Cucumber has its own list: http://groups.google.com/group/cukes, so you
may get more responses there.

I’d do something like this (incomplete and untested, but …):

And “Website” should link to “www.happyhour.com

Then /^“([^"])" should link to "([^"])”$/ do |text, href|
response.should have_xpath(<figure out the xpath including @href and
text()>)
end

thanks! i’ll use cucumber list next time.