mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add exact
config option
This commit is contained in:
parent
aa3d3e1ead
commit
83570f3ece
4 changed files with 12 additions and 3 deletions
|
@ -16,7 +16,7 @@ module Capybara
|
|||
|
||||
class << self
|
||||
attr_accessor :asset_root, :app_host, :run_server, :default_host, :always_include_port
|
||||
attr_accessor :server_host, :server_port
|
||||
attr_accessor :server_host, :server_port, :exact
|
||||
attr_accessor :default_selector, :default_wait_time, :ignore_hidden_elements
|
||||
attr_accessor :save_and_open_page_path, :automatic_reload
|
||||
attr_writer :default_driver, :current_driver, :javascript_driver, :session_name
|
||||
|
|
|
@ -11,6 +11,10 @@ module Capybara
|
|||
@options[:visible] = Capybara.ignore_hidden_elements
|
||||
end
|
||||
|
||||
unless options.has_key?(:exact)
|
||||
@options[:exact] = Capybara.exact
|
||||
end
|
||||
|
||||
if args[0].is_a?(Symbol)
|
||||
@selector = Selector.all[args[0]]
|
||||
@locator = args[1]
|
||||
|
@ -27,7 +31,6 @@ module Capybara
|
|||
@xpath = @xpath.to_s
|
||||
end
|
||||
|
||||
|
||||
assert_valid_keys!
|
||||
end
|
||||
|
||||
|
|
|
@ -127,7 +127,12 @@ Capybara::SpecHelper.spec '#find' do
|
|||
end
|
||||
|
||||
it "defaults to `Capybara.exact`" do
|
||||
|
||||
Capybara.exact = true
|
||||
expect do
|
||||
@session.find(:xpath, XPath.descendant(:input)[XPath.attr(:id).is("est_fiel")])
|
||||
end.to raise_error(Capybara::ElementNotFound)
|
||||
Capybara.exact = false
|
||||
@session.find(:xpath, XPath.descendant(:input)[XPath.attr(:id).is("est_fiel")])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ module Capybara
|
|||
Capybara.app_host = nil
|
||||
Capybara.default_selector = :xpath
|
||||
Capybara.default_wait_time = 1
|
||||
Capybara.exact = false
|
||||
end
|
||||
|
||||
def filter(requires, metadata)
|
||||
|
|
Loading…
Reference in a new issue