For example, consider the following script:
require 'rubygems'
require 'watir-webdriver'
browser = Watir::Browser.new(:firefox)
browser.goto("http://tinypic.com/")
file = "C:\\\\assets\\image.jpg"
browser.file_field(:name,"the_file").set(file)
browser.close
Which will work, I will be able to add the file into the file_field but I always have to have image.jpg in C:\\assets
and I don't want this to always be enforced. I'd like to search the underlying OS and find the path for the file I want to use and I'd like the script to be able to run on Windows and *nix systems. Relying on hard-coding the file's location as a string is somewhat limiting.
It should help to know that the files I wish to use will be under source control and will always be in a specific location in relation to the test script - the directory will always be something like ../../assets
.