module RSpec::SleepingKingStudios::Concerns::WrapEnv

Methods for temporarily overwriting values in the environment, which are safely and automatically reset after the block or example.

Public Instance Methods

stub_env(key, value)
Alias for: wrap_env
wrap_env(key, value) { || ... } click to toggle source
# File lib/rspec/sleeping_king_studios/concerns/wrap_env.rb, line 36
def wrap_env key, value
  prior_value = ENV[key]
  ENV[key]    = value

  yield
ensure
  ENV[key]    = prior_value
end
Also aliased as: stub_env