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
1 changed files with 1 additions and 1 deletions

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)