Sha256: 890726154cd4e7244edbd09ec36acd1c6f66d342c07bca052dd49d1418b50a01

Contents?: true

Size: 255 Bytes

Versions: 9

Compression:

Stored size: 255 Bytes

Contents

def set_env(*args, &_block)
  hash = args.first.is_a?(Hash) ? args.first : Hash[*args]
  old_values = Hash[hash.map { |k, _| [k, ENV[k]] }]
  begin
    hash.each { |k, v| ENV[k] = v }
    yield
  ensure
    old_values.each { |k, v| ENV[k] = v }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
aptible-billing-1.0.1 spec/shared/set_env.rb
aptible-billing-1.0.0 spec/shared/set_env.rb
aptible-billing-0.1.7 spec/shared/set_env.rb
aptible-billing-0.1.6 spec/shared/set_env.rb
aptible-billing-0.1.5 spec/shared/set_env.rb
aptible-billing-0.1.4 spec/shared/set_env.rb
aptible-billing-0.1.3 spec/shared/set_env.rb
aptible-billing-0.1.2 spec/shared/set_env.rb
aptible-billing-0.1.1 spec/shared/set_env.rb