Sha256: 22df40339671755689d68573ccb1911367d0d9514c8adfc6bd4501f938221ae6
Contents?: true
Size: 795 Bytes
Versions: 7
Compression:
Stored size: 795 Bytes
Contents
require 'yaml' require 'erubis' require 'fileutils' require 'pathname' SPEC_ROOT = File.expand_path(File.dirname(__FILE__)) class Hash def symbolize_keys! keys.each do |key| self[(key.to_sym rescue key) || key] = delete(key) end self end end module BaseTest class << self def config @config ||= read_config end private def config_file Pathname.new(ENV['NUODB_CONFIG'] || File.join(SPEC_ROOT, 'config.yml')) end def read_config unless config_file.exist? FileUtils.cp(File.join(SPEC_ROOT, 'config.example.yml'), config_file) end erb = Erubis::Eruby.new(config_file.read) expand_config(YAML.parse(erb.result(binding)).transform) end def expand_config(config) config end end end
Version data entries
7 entries across 7 versions & 1 rubygems