From 9bf7894d31fbceed68c814d5a8ff9abcaacbd2b1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 29 Oct 2010 13:41:49 +0200 Subject: [PATCH] Removed deprecated stuff --- lib/capybara/driver/base.rb | 7 +------ lib/capybara/node.rb | 9 --------- lib/capybara/node/actions.rb | 13 +------------ lib/capybara/node/finders.rb | 9 --------- lib/capybara/session.rb | 11 +---------- .../spec/session/click_link_or_button_spec.rb | 5 ++--- lib/capybara/spec/session/find_spec.rb | 6 ------ 7 files changed, 5 insertions(+), 55 deletions(-) diff --git a/lib/capybara/driver/base.rb b/lib/capybara/driver/base.rb index 07b79cd7..2b0d4f97 100644 --- a/lib/capybara/driver/base.rb +++ b/lib/capybara/driver/base.rb @@ -30,7 +30,7 @@ class Capybara::Driver::Base def response_headers raise Capybara::NotSupportedByDriverError end - + def status_code raise Capybara::NotSupportedByDriverError end @@ -53,11 +53,6 @@ class Capybara::Driver::Base def reset! end - def cleanup! - Capybara.deprecate("cleanup!", "reset!") - reset! - end - def has_shortcircuit_timeout? false end diff --git a/lib/capybara/node.rb b/lib/capybara/node.rb index 3dd61d03..b1f2c668 100644 --- a/lib/capybara/node.rb +++ b/lib/capybara/node.rb @@ -72,15 +72,6 @@ module Capybara base.native end - ## - # - # @deprecated node is deprecated, please use {Capybara::Element#native} instead - # - def node - Capybara.deprecate("node", "native") - native - end - ## # # @return [String] The text of the element diff --git a/lib/capybara/node/actions.rb b/lib/capybara/node/actions.rb index 8fc52e34..1d76a103 100644 --- a/lib/capybara/node/actions.rb +++ b/lib/capybara/node/actions.rb @@ -13,6 +13,7 @@ module Capybara msg = "no link or button '#{locator}' found" find(:xpath, XPath::HTML.link_or_button(locator), :message => msg).click end + alias_method :click_on, :click_link_or_button ## # @@ -153,18 +154,6 @@ module Capybara msg = "cannot attach file, no file field with id, name, or label '#{locator}' found" find(:xpath, XPath::HTML.file_field(locator), :message => msg).set(path) end - - ## - # - # Drag one element to another - # - # @deprecated Use Capybara::Element#drag_to instead. - # - def drag(source_locator, target_locator) - source = find(:xpath, source_locator, :message => "drag source '#{source_locator}' not found on page") - target = find(:xpath, target_locator, :message => "drag target '#{target_locator}' not found on page") - source.drag_to(target) - end end end end diff --git a/lib/capybara/node/finders.rb b/lib/capybara/node/finders.rb index df9c3b8f..32e30979 100644 --- a/lib/capybara/node/finders.rb +++ b/lib/capybara/node/finders.rb @@ -31,15 +31,6 @@ module Capybara return node end - ## - # - # @deprecated {#find} now behaves like locate used to. Use {#find} instead. - # - def locate(*args) - Capybara.deprecate("locate", "find") - find(*args) - end - ## # # Find a form field on the page. The field can be found by its name, id or label text. diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 5be15b81..8fe432e8 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -32,7 +32,7 @@ module Capybara :has_no_content?, :has_no_css?, :has_no_xpath?, :has_xpath?, :locate, :save_and_open_page, :select, :source, :uncheck, :visit, :wait_until, :within, :within_fieldset, :within_table, :within_frame, :within_window, :has_link?, :has_no_link?, :has_button?, :has_no_button?, :has_field?, :has_no_field?, :has_checked_field?, :has_unchecked_field?, :has_no_table?, :has_table?, - :unselect, :has_select?, :has_no_select?, :current_path, :click, :has_selector?, :has_no_selector? + :unselect, :has_select?, :has_no_select?, :current_path, :click, :has_selector?, :has_no_selector?, :click_on ] attr_reader :mode, :app @@ -247,15 +247,6 @@ module Capybara driver.evaluate_script(script) end - ## - # - # @deprecated click is deprecated, please use {Capybara::Node::Actions#click_link_or_button} instead - # - def click(locator) - Capybara.deprecate("click", "click_link_or_button") - current_node.click_link_or_button(locator) - end - ## # # Save a snapshot of the page and open it in a browser for inspection diff --git a/lib/capybara/spec/session/click_link_or_button_spec.rb b/lib/capybara/spec/session/click_link_or_button_spec.rb index c1be92ed..7044fa6f 100644 --- a/lib/capybara/spec/session/click_link_or_button_spec.rb +++ b/lib/capybara/spec/session/click_link_or_button_spec.rb @@ -18,10 +18,9 @@ shared_examples_for "click_link_or_button" do extract_results(@session)['first_name'].should == 'John' end - it "should be aliased as click for backward compatibility" do - Capybara.should_receive(:deprecate).with("click", "click_link_or_button") + it "should be aliased as click_on" do @session.visit('/form') - @session.click('awe123') + @session.click_on('awe123') extract_results(@session)['first_name'].should == 'John' end diff --git a/lib/capybara/spec/session/find_spec.rb b/lib/capybara/spec/session/find_spec.rb index d5b62fdb..17557bec 100644 --- a/lib/capybara/spec/session/find_spec.rb +++ b/lib/capybara/spec/session/find_spec.rb @@ -13,12 +13,6 @@ shared_examples_for "find" do @session.find("//input[@id='test_field']")[:value].should == 'monkey' end - it "should be aliased as locate for backward compatibility" do - Capybara.should_receive(:deprecate).with("locate", "find").twice - @session.locate('//h1').text.should == 'This is a test' - @session.locate("//input[@id='test_field']")[:value].should == 'monkey' - end - it "should find the first element using the given locator and options" do @session.find('//a', :text => 'Redirect')[:id].should == 'red' @session.find(:css, 'a', :text => 'A link')[:title].should == 'twas a fine link'