Last Updated: February 25, 2016
·
1.3K
· shavit

Load environment variables from .env file when testing

#
# If you are working with the foreman gem and .env files, you are probably need to load 
#   the environment varialbes from the .env file.
#

# Load the environment variables from the .env file in development.
open('.env', 'r').readlines.each {|l| kv = l.split('='); ENV[kv[0]] = kv[1];}

https://gist.github.com/shavit/2fe08a6ec08b3cfdc649