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

Use Array coercion on uploaded files - fixes #848

This allows classes that aren't String but are similar enough
(like Pathname) to be used as upload paths.
This commit is contained in:
Jake Goulding 2012-11-20 16:51:25 -05:00
parent 85c7ef5edc
commit b13b6e7c7e

View file

@ -138,7 +138,7 @@ module Capybara
# @param [String] path The path of the file that will be attached, or an array of paths
#
def attach_file(locator, path)
(String === path ? [path] : path).each do |p|
Array(path).each do |p|
raise Capybara::FileNotFound, "cannot attach file, #{p} does not exist" unless File.exist?(p.to_s)
end
find(:file_field, locator).set(path)