class Lopata::Environment

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'.

Public Class Methods

new(env = Lopata.configuration.env) click to toggle source

Loads environment configuration for given env @param env [Symbol] environment key

Loads golobl configured environment if not given.

@see Lopata::Configuration#env

# File lib/lopata/environment.rb, line 17
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

Public Instance Methods

[](key) click to toggle source

Access to environment settings @param key [Symbol] environment configuration key is set on yml configuration.

# File lib/lopata/environment.rb, line 26
def [](key)
  @config[key]
end