The step definition below allows you to write:
Then I should see a link labeled "Foo"
But I should not see a link labeled "Bar"
Webrat
Then /^I should( not)? see a link labeled "([^"]*)"$/ do |negate, label|
expectation = negate ? :should_not : :should
response.send(expectation, have_selector("a", :content => label))
end
Capybara
Then /^I should( not)? see a link labeled "([^"]*)"$/ do |negate, label|
expectation = negate ? :should_not : :should
page.send(expectation, have_css('a', :text => label))
end
Posted by Henning Koch to makandra dev (2011-07-07 14:00)