mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add Capybara.deprecate
Deprecate methods using this, and set rspec expectations in suite to prevent deprecation warnings from getting output.
This commit is contained in:
parent
19e1ffc084
commit
d584bb34e9
7 changed files with 10 additions and 4 deletions
|
@ -66,6 +66,10 @@ module Capybara
|
|||
def drivers
|
||||
@drivers ||= {}
|
||||
end
|
||||
|
||||
def deprecate(method, alternate_method)
|
||||
warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead"
|
||||
end
|
||||
end
|
||||
|
||||
autoload :Server, 'capybara/server'
|
||||
|
|
|
@ -50,7 +50,7 @@ class Capybara::Driver::Base
|
|||
end
|
||||
|
||||
def cleanup!
|
||||
warn "DEPRECATED: #cleanup! has been renamed to #reset!"
|
||||
Capybara.deprecate("cleanup!", "reset!")
|
||||
reset!
|
||||
end
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ module Capybara
|
|||
# @deprecated node is deprecated, please use {Capybara::Element#native} instead
|
||||
#
|
||||
def node
|
||||
warn "DEPRECATED: #node is deprecated, please use #native instead"
|
||||
Capybara.deprecate("node", "native")
|
||||
native
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ module Capybara
|
|||
# @deprecated {#find} now behaves like locate used to. Use {#find} instead.
|
||||
#
|
||||
def locate(*args)
|
||||
warn "DEPRECATED: Please use #find instead of #locate"
|
||||
Capybara.deprecate("locate", "find")
|
||||
find(*args)
|
||||
end
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ module Capybara
|
|||
# @deprecated click is deprecated, please use {Capybara::Node::Actions#click_link_or_button} instead
|
||||
#
|
||||
def click(locator)
|
||||
warn "DEPRECATED: click is deprecated, use click_link_or_button instead"
|
||||
Capybara.deprecate("click", "click_link_or_button")
|
||||
current_node.click_link_or_button(locator)
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ shared_examples_for "click_link_or_button" do
|
|||
end
|
||||
|
||||
it "should be aliased as click for backward compatibility" do
|
||||
Capybara.should_receive(:deprecate).with("click", "click_link_or_button")
|
||||
@session.visit('/form')
|
||||
@session.click('awe123')
|
||||
extract_results(@session)['first_name'].should == 'John'
|
||||
|
|
|
@ -14,6 +14,7 @@ shared_examples_for "find" do
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue