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.
This commit is contained in:
Matt Wildig 2014-11-26 19:55:49 +00:00
parent 908fad0dc4
commit b09bf0a900
1 changed files with 5 additions and 6 deletions

View File

@ -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