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:
parent
85c7ef5edc
commit
b13b6e7c7e
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue