mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
warn if selector type is unknown
This commit is contained in:
parent
f0f0d91fb5
commit
1af5c17d65
2 changed files with 9 additions and 1 deletions
|
@ -11,7 +11,10 @@ module Capybara
|
|||
@options = if args.last.is_a?(Hash) then args.pop.dup else {} end
|
||||
|
||||
if args[0].is_a?(Symbol)
|
||||
@selector = Selector.all[args.shift]
|
||||
@selector = Selector.all.fetch(args.shift) do |selector_type|
|
||||
warn "Unknown selector type (:#{selector_type}), defaulting to :#{Capybara.default_selector} - This will raise an exception in a future version of Capybara"
|
||||
nil
|
||||
end
|
||||
@locator = args.shift
|
||||
else
|
||||
@selector = Selector.all.values.find { |s| s.match?(args[0]) }
|
||||
|
|
|
@ -416,4 +416,9 @@ Capybara::SpecHelper.spec '#find' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should warn if selector type is unknown" do
|
||||
expect_any_instance_of(Kernel).to receive(:warn).with(/^Unknown selector type/)
|
||||
@session.find(:unknown, '//h1')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue