Sha256: 3dab776163fa5927d3317c228b9d7c669977b7156f7967e649b871d41af07196

Contents?: true

Size: 608 Bytes

Versions: 5

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

##
# Confset Rspec Helpers
#

# Loads ENV vars from a yaml file
def load_env(filename)
  if filename && File.exist?(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) Confset const is already available
def config_available?
  where = caller[0].split(":")[0].gsub(File.expand_path(File.dirname(__FILE__)), "")

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
confset-1.1.0 spec/support/rails_helper.rb
confset-1.0.3 spec/support/rails_helper.rb
confset-1.0.2 spec/support/rails_helper.rb
confset-1.0.1 spec/support/rails_helper.rb
confset-1.0.0 spec/support/rails_helper.rb