Sha256: 7feafda9d0ce047c8622f19ffc31c1ce7b514723f1cfb6ab3ff5fd667f61534d
Contents?: true
Size: 371 Bytes
Versions: 3
Compression:
Stored size: 371 Bytes
Contents
require 'dotenv' # Runs block with ENV variables loaded from specified file, # restores original ENV variables after. # # @example # with_env_vars('.env.test') do # application.config.load # end # def with_env_vars(filename = nil, &_block) original_env_vars = ENV.to_hash Dotenv.load(filename) if filename yield ensure ENV.replace(original_env_vars) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mimi-0.1.4 | lib/mimi/cli/template/spec/support/envvars.rb |
mimi-0.1.3 | lib/mimi/cli/template/spec/support/envvars.rb |
mimi-0.1.1 | lib/mimi/cli/template/spec/support/envvars.rb |