Don't swallow errors in find, closes #190

This commit is contained in:
Anders Törnqvist 2010-12-10 14:27:26 +01:00
parent b022ca9926
commit 05d969756f
1 changed files with 4 additions and 3 deletions

View File

@ -25,9 +25,10 @@ module Capybara
#
def find(*args)
node = wait_conditionally_until { all(*args).first }
ensure
options = if args.last.is_a?(Hash) then args.last else {} end
raise Capybara::ElementNotFound, options[:message] || "Unable to find '#{args[1] || args[0]}'" unless node
unless node
options = if args.last.is_a?(Hash) then args.last else {} end
raise Capybara::ElementNotFound, options[:message] || "Unable to find '#{args[1] || args[0]}'"
end
return node
end