aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/testing_env.rb
diff options
context:
space:
mode:
authorTim D. Smith2016-06-29 10:33:08 -0700
committerTim D. Smith2016-06-29 21:16:50 -0700
commitf04ffb614d7e76997039f42d4406494e25d3390a (patch)
tree7c71a27940f06a4806962e878a88afd7cedb17b0 /Library/Homebrew/test/testing_env.rb
parent4e927d9ce855cbd74b2f893237bb2b6489f88da8 (diff)
downloadbrew-f04ffb614d7e76997039f42d4406494e25d3390a.tar.bz2
Move with_environment to testing_env
Diffstat (limited to 'Library/Homebrew/test/testing_env.rb')
-rw-r--r--Library/Homebrew/test/testing_env.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 6be622cc5..214aa9789 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -120,5 +120,15 @@ module Homebrew
def bundle_path(name)
Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle")
end
+
+ def with_environment(partial_env)
+ old = ENV.to_hash
+ ENV.update partial_env
+ begin
+ yield
+ ensure
+ ENV.replace old
+ end
+ end
end
end