Rake, bundler and File.dirname(__FILE__)
I noticed the other day on a project I'm working on that tests would work fine when called by rake, but failed with bundle and guard. Turns out File.dirname(__FILE__) is based on the location of the initializing script. To fix the tests for all environments try this: File.dirname(File.realdirpath(__FILE__))
Written by Jason Porter
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Did you know?
Guarding a web app includes the code that arrives in the browser, not only the code in source control. Tags and dependencies can change in production between deploys.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#