Module: RSpec::SleepingKingStudios::Concerns::WrapEnv
- Extended by:
- SleepingKingStudios::Tools::Toolbox::Mixin
- Defined in:
- lib/rspec/sleeping_king_studios/concerns/wrap_env.rb
Overview
Methods for temporarily overwriting values in the environment, which are safely and automatically reset after the block or example.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#wrap_env(key, value) ⇒ Object
(also: #stub_env)
module.
Instance Method Details
#wrap_env(key, value) ⇒ Object Also known as: stub_env
module
36 37 38 39 40 41 42 43 |
# 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 |