diff options
author | Jonathan Dance <jd@wuputah.com> | 2011-02-25 04:26:13 -0600 |
---|---|---|
committer | Jonathan Dance <jd@wuputah.com> | 2011-02-25 15:55:21 -0600 |
commit | 926836d9fbb5a1860dcbcb02d751b0b1f595db53 (patch) | |
tree | eb1b80f4c577c5ae7af6267bf4e5be8bd4ed1677 /spec/runtime/with_clean_env_spec.rb | |
parent | 5cf3fde78c2660ff8a815f376921438fd641c67d (diff) | |
download | bundler-926836d9fbb5a1860dcbcb02d751b0b1f595db53.tar.gz |
add Bundler.clean_system and Bundler.clean_exec
Diffstat (limited to 'spec/runtime/with_clean_env_spec.rb')
-rw-r--r-- | spec/runtime/with_clean_env_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index b0d4094b..8308271e 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -45,3 +45,34 @@ describe "Bundler.with_original_env" do end end + +describe "Bundler.clean_system" do + + it "runs system inside with_clean_env" do + bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH'] + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile" + + Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh}) + $?.exitstatus.should == 42 + + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path + end + +end + +describe "Bundler.clean_exec" do + + it "runs exec inside with_clean_env" do + bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH'] + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile" + + pid = Kernel.fork do + Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh}) + end + Process.wait(pid) + $?.exitstatus.should == 42 + + Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path + end + +end |