From d0c41f3f4c140d0b1a2bf81c66cba0a07654efe7 Mon Sep 17 00:00:00 2001 From: Steve Valaitis Date: Sun, 16 Jan 2011 17:08:16 -0600 Subject: [PATCH] has_link? does not accept non-hashed href --- lib/capybara/node/matchers.rb | 7 ------- lib/capybara/spec/session/has_link_spec.rb | 4 ---- 2 files changed, 11 deletions(-) diff --git a/lib/capybara/node/matchers.rb b/lib/capybara/node/matchers.rb index db914d14..84a55c46 100644 --- a/lib/capybara/node/matchers.rb +++ b/lib/capybara/node/matchers.rb @@ -207,7 +207,6 @@ module Capybara # @return [Boolean] Whether it exists # def has_link?(locator, options={}) - options = set_link_options options has_xpath?(XPath::HTML.link(locator, options)) end @@ -220,7 +219,6 @@ module Capybara # @return [Boolean] Whether it doesn't exist # def has_no_link?(locator, options={}) - options = set_link_options options has_no_xpath?(XPath::HTML.link(locator, options)) end @@ -377,11 +375,6 @@ module Capybara def has_no_table?(locator, options={}) has_no_xpath?(XPath::HTML.table(locator, options)) end - - private - def set_link_options(options) - String===options ? {:href => options} : options - end end end end diff --git a/lib/capybara/spec/session/has_link_spec.rb b/lib/capybara/spec/session/has_link_spec.rb index 09e7bcf9..15a8c204 100644 --- a/lib/capybara/spec/session/has_link_spec.rb +++ b/lib/capybara/spec/session/has_link_spec.rb @@ -8,13 +8,11 @@ shared_examples_for "has_link" do it "should be true if the given link is on the page" do @session.should have_link('foo') @session.should have_link('awesome title') - @session.should have_link('A link', '/with_simple_html') @session.should have_link('A link', :href => '/with_simple_html') end it "should be false if the given link is not on the page" do @session.should_not have_link('monkey') - @session.should_not have_link('A link', '/non-existant-href') @session.should_not have_link('A link', :href => '/non-existant-href') end end @@ -27,13 +25,11 @@ shared_examples_for "has_link" do it "should be false if the given link is on the page" do @session.should_not have_no_link('foo') @session.should_not have_no_link('awesome title') - @session.should_not have_no_link('A link', '/with_simple_html') @session.should_not have_no_link('A link', :href => '/with_simple_html') end it "should be true if the given link is not on the page" do @session.should have_no_link('monkey') - @session.should have_no_link('A link', '/non-existant-href') @session.should have_no_link('A link', :href => '/non-existant-href') end end