Sha256: 1891422a0b62c041eb4c1434013e1af1a26806be9713b4588d7afb77ea2bc54c

Contents?: true

Size: 387 Bytes

Versions: 21

Compression:

Stored size: 387 Bytes

Contents

module Helpers
  def with_env(opts = {})
    old = {}
    opts.each do |k, v|
      k = k.to_s
      v = v.to_s unless v.nil?
      old[k] = ENV[k]
      ENV[k] = v
    end
    yield
  ensure
    old.each do |k, v|
      ENV[k] = v
    end
  end

  def with_rails_env(env)
    initial_env = WebValve.env
    WebValve.env = env
    yield
  ensure
    WebValve.env = initial_env
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
webvalve-2.0.4 spec/support/helpers.rb
webvalve-2.0.3 spec/support/helpers.rb
webvalve-2.0.2 spec/support/helpers.rb
webvalve-2.0.0 spec/support/helpers.rb
webvalve-1.3.1 spec/support/helpers.rb
webvalve-1.3.0 spec/support/helpers.rb
webvalve-1.2.0 spec/support/helpers.rb
webvalve-1.1.0 spec/support/helpers.rb
webvalve-1.0.2 spec/support/helpers.rb
webvalve-1.0.1 spec/support/helpers.rb
webvalve-1.0.0 spec/support/helpers.rb
webvalve-0.12.0 spec/support/helpers.rb
webvalve-0.11.0 spec/support/helpers.rb
webvalve-0.10.0 spec/support/helpers.rb
webvalve-0.9.10 spec/support/helpers.rb
webvalve-0.9.9 spec/support/helpers.rb
webvalve-0.9.8 spec/support/helpers.rb
webvalve-0.9.7 spec/support/helpers.rb
webvalve-0.9.6 spec/support/helpers.rb
webvalve-0.9.5 spec/support/helpers.rb