module FeduxOrgStdlib::Environment

Enviroment helpers

@deprecated Please use github.com/cucumber/aruba instead

Public Instance Methods

isolated_environment(new_environment_variables, options = {}, &block) click to toggle source

Set environment variable for code block

@param [Hash] new_environment_variables

the variables which should be set for that environment

@param [Hash] options

options for environment manipulation

@option options [True,False] :clear

Should the environment clear before merge?

@yield

the block which should be run which the change environment
# File lib/fedux_org_stdlib/environment.rb, line 20
def isolated_environment(new_environment_variables, options = {}, &block)
  old_environment = ENV.to_hash

  ENV.clear if options[:clear] == true
  ENV.update new_environment_variables

  block.call
ensure
  ENV.clear
  ENV.update old_environment
end
Also aliased as: with_environment
with_environment(new_environment_variables, options = {}, &block)