Sha256: 1356a0c2a74c947ca39437f44543c04b87d4ba7cb9c5f23a9f404c8897d0bceb
Contents?: true
Size: 1.15 KB
Versions: 8
Compression:
Stored size: 1.15 KB
Contents
module Lopata # Settings of test enviromnet the scenarios to be runned. # # Lopata allows to define different environments the scenarios to be runned on. # Set environment name via command line 'lopata -e stage' or via configuration: # # Lopata.configure do |c| # c.env = :stage # end # # The environment params are loaded from './config/environments/<env>.yml'. class Environment # Loads environment configuration for given env # @param env [Symbol] environment key # Loads golobl configured environment if not given. # @see Lopata::Configuration#env def initialize(env = Lopata.configuration.env) require 'yaml' @config = {} config_filename = "./config/environments/#{Lopata.configuration.env}.yml" @config = YAML::load(File.open(config_filename)) if File.exists?(config_filename) end # Access to environment settings # @param key [Symbol] environment configuration key is set on yml configuration. def [](key) @config[key] end %w{url}.each do |opt| define_method opt do @config[opt] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems