1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge pull request #1660 from alextaylor000/update-attach-file-docs

Add documention for Capybara::Node::Actions#attach_file options hash
This commit is contained in:
Thomas Walpole 2016-03-01 11:01:08 -08:00
commit e36f2a2226

View file

@ -150,6 +150,11 @@ module Capybara
# @param [String] locator Which field to attach the file to
# @param [String] path The path of the file that will be attached, or an array of paths
#
# @option options [Symbol] match (Capybara.match) The matching strategy to use (:one, :first, :prefer_exact, :smart).
# @option options [Boolean] exact (Capybara.exact) Match the exact label name/contents or accept a partial match.
# @option options [Fixnum] wait (Capybara.default_max_wait_time) If using a Javascript driver, maximum number of seconds during which the element will be searched for.
# @option options [Boolean] multiple Match field which allows multiple file selection
#
def attach_file(locator, path, options={})
Array(path).each do |p|
raise Capybara::FileNotFound, "cannot attach file, #{p} does not exist" unless File.exist?(p.to_s)