[rspec-users] help me refactor a step for finding href in specific link

Oren Golan lists at ruby-forum.com
Wed Mar 31 18:13:42 EDT 2010

I want to verify the href is correct:
<p class="website">
    <a href="http://www.com.com">Website</a>

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

it's doesn't look good and would like to hear suggestion for improving
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list