I’m building an app with some extension parsing functionality mainly with excel files. I want my spec tests to be able to use example excel files. This is easy on my development machine, but how can I include this so that I can run the spec tests on the staging server as well?
I tried including the file in the same directory as the spec test file and it didn’t work.
I’m using roo as the gem to parse Excel files.
The only one I could get to work was explicitly putting in something like:
test_ss = Excel.new('c:/myfolder/excelfile.xls')
I tried putting the file in c:\myapp\spec\ folder where the spec test resides and it couldn’t find it:
test_ss = Excel.new('excelfile.xls')
When you don’t explicitly specify the path, Rails will just assume you mean the rails root. So if you want it to search the spec folder, you have to
or better yet,
which will be an explicit path that’s unique to each environment.