From b09bf0a900ef95216ecf571e08c4a068ff563360 Mon Sep 17 00:00:00 2001 From: Matt Wildig Date: Wed, 26 Nov 2014 19:55:49 +0000 Subject: [PATCH] Use Bundler.with_clean_env Use Bundler.with_clean_env for cleaner behaviour when performing actions for different test Gemfiles, mainly installing dependencies. Previously, running e.g. `bundle exec rake test:rc` could resuly in errors as the parent Bundler environment was fully removed. --- Rakefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index bb057001..2ff11210 100644 --- a/Rakefile +++ b/Rakefile @@ -108,14 +108,13 @@ def gemfiles end def with_each_gemfile - old_env = ENV['BUNDLE_GEMFILE'] gemfiles.each do |gemfile| - puts "Using gemfile: #{gemfile}" - ENV['BUNDLE_GEMFILE'] = gemfile - yield + Bundler.with_clean_env do + puts "Using gemfile: #{gemfile}" + ENV['BUNDLE_GEMFILE'] = gemfile + yield + end end -ensure - ENV['BUNDLE_GEMFILE'] = old_env end namespace :test do