Sha256: 05182d2b534f423a02ceb34c2285c048f4ada46cf5c5352252d6b38a60ea725d

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

##
# Config Rspec Helpers
#

# Loads ENV vars from a yaml file
def load_env(filename)
  if filename and File.exists?(filename.to_s)
    result = YAML.load(ERB.new(IO.read(filename.to_s)).result)
  end
  result.each { |key, value| ENV[key.to_s] = value.to_s } unless result.nil?
end

# Checks if (default) Config const is already available
def config_available?
  where = caller[0].split(':')[0].gsub(File.expand_path(File.dirname(__FILE__)), '')

  if defined?(::Settings)
    puts "Config available in #{where}"
  else
    raise "Config not available in #{where}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
config-1.0.0 spec/support/rails_config_helper.rb
config-1.0.0.beta3 spec/support/rails_config_helper.rb
config-1.0.0.beta2 spec/support/rails_config_helper.rb
config-1.0.0.beta1 spec/support/rails_config_helper.rb