summaryrefslogtreecommitdiff
path: root/spec/runtime/with_clean_env_spec.rb
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-01-30 19:57:30 -0600
committerAndre Arko <andre@arko.net>2016-01-31 14:05:00 -0800
commitd713762416079b862d287b5806c4e6f5e7b4146c (patch)
treeb54603bdfca5be26ed07532747b7ddf462cbef65 /spec/runtime/with_clean_env_spec.rb
parent6c2664fe442209d84d8b6954e7eba2b2fe034a21 (diff)
downloadbundler-d713762416079b862d287b5806c4e6f5e7b4146c.tar.gz
Preserve PATH in with_clean_env
Diffstat (limited to 'spec/runtime/with_clean_env_spec.rb')
-rw-r--r--spec/runtime/with_clean_env_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb
index 0ceb4adf05..55c6ed98ed 100644
--- a/spec/runtime/with_clean_env_spec.rb
+++ b/spec/runtime/with_clean_env_spec.rb
@@ -4,12 +4,15 @@ describe "Bundler.with_env helpers" do
shared_examples_for "Bundler.with_*_env" do
it "should reset and restore the environment" do
gem_path = ENV["GEM_PATH"]
+ path = ENV["PATH"]
Bundler.with_clean_env do
expect(`echo $GEM_PATH`.strip).not_to eq(gem_path)
+ expect(`echo $PATH`.strip).not_to eq(path)
end
expect(ENV["GEM_PATH"]).to eq(gem_path)
+ expect(ENV["PATH"]).to eq(path)
end
end
@@ -35,6 +38,18 @@ describe "Bundler.with_env helpers" do
expect(result).to eq("true")
end
+ it "should keep the original PATH even in sub processes" do
+ gemfile ""
+ bundle "install --path vendor/bundle"
+
+ code = "Bundler.with_clean_env do;" \
+ " print ENV['PATH'] != '';" \
+ "end"
+
+ result = bundle "exec ruby -e #{code.inspect}"
+ expect(result).to eq("true")
+ end
+
it "should not pass any bundler environment variables" do
Bundler.with_clean_env do
expect(`echo $BUNDLE_PATH`.strip).not_to eq("./Gemfile")