diff options
author | Jonathan Dance <jd@wuputah.com> | 2011-02-23 22:29:11 -0600 |
---|---|---|
committer | Jonathan Dance <jd@wuputah.com> | 2011-02-25 15:55:21 -0600 |
commit | 5cf3fde78c2660ff8a815f376921438fd641c67d (patch) | |
tree | fe996f0570add648dac32355bb8747aeda5c3e89 /spec/runtime/with_clean_env_spec.rb | |
parent | 782a11ee9cc20183593f174d73364e0b4efd5dc7 (diff) | |
download | bundler-5cf3fde78c2660ff8a815f376921438fd641c67d.tar.gz |
with_clean_env clears bundler env vars
old behavior is at Bundler.with_original_env
Diffstat (limited to 'spec/runtime/with_clean_env_spec.rb')
-rw-r--r-- | spec/runtime/with_clean_env_spec.rb | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index 51ecc29e..b0d4094b 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -1,7 +1,6 @@ require "spec_helper" -describe "Bundler.with_clean_env" do - +shared_examples_for "Bundler.with_*_env" do it "should reset and restore the environment" do gem_path = ENV['GEM_PATH'] @@ -11,5 +10,38 @@ describe "Bundler.with_clean_env" do ENV['GEM_PATH'].should == gem_path end +end + +describe "Bundler.with_clean_env" do + + it_should_behave_like "Bundler.with_*_env" + + it "should not pass any bundler environment variables" do + bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH'] + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile" + + Bundler.with_clean_env do + `echo $BUNDLE_PATH`.strip.should_not == './Gemfile' + end + + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path + end + +end + +describe "Bundler.with_original_env" do + + it_should_behave_like "Bundler.with_*_env" + + it "should pass bundler environment variables set before Bundler was run" do + bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH'] + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile" + + Bundler.with_original_env do + `echo $BUNDLE_PATH`.strip.should == './Gemfile' + end + + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path + end -end
\ No newline at end of file +end |