summaryrefslogtreecommitdiff
path: root/test/rake/in_environment.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-23 22:11:55 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-23 22:11:55 +0000
commitd001539a0538cba0e48be2ebdafe29e67b006a4e (patch)
treeabf1591ca3b56f04f46cc2cce9918700620a3ab1 /test/rake/in_environment.rb
parent3fbc9440feb66cf762834b6d66e6f3a893bab5b7 (diff)
* lib/rake: Import Rake 0.9.2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/in_environment.rb')
-rw-r--r--test/rake/in_environment.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/test/rake/in_environment.rb b/test/rake/in_environment.rb
deleted file mode 100644
index f6fd8fb731..0000000000
--- a/test/rake/in_environment.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-module InEnvironment
- private
-
- # Create an environment for a test. At the completion of the yielded
- # block, the environment is restored to its original conditions.
- def in_environment(settings)
- original_settings = set_env(settings)
- yield
- ensure
- set_env(original_settings) if original_settings
- end
-
- # Set the environment according to the settings hash.
- def set_env(settings) # :nodoc:
- result = {}
- settings.each do |k, v|
- result[k] = ENV[k]
- if k == 'PWD'
- result[k] = Dir.pwd
- Dir.chdir(v)
- elsif v.nil?
- ENV.delete(k)
- else
- ENV[k] = v
- end
- end
- result
- end
-
-end