Class: Lopata::Environment
- Inherits:
-
Object
- Object
- Lopata::Environment
- Defined in:
- lib/lopata/environment.rb
Overview
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’.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Access to environment settings.
-
#initialize(env = Lopata.configuration.env) ⇒ Environment
constructor
Loads environment configuration for given env.
Constructor Details
#initialize(env = Lopata.configuration.env) ⇒ Environment
Loads environment configuration for given env
17 18 19 20 21 22 |
# 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.exist?(config_filename) end |
Instance Method Details
#[](key) ⇒ Object
Access to environment settings
26 27 28 |
# File 'lib/lopata/environment.rb', line 26 def [](key) @config[key] end |