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:
parent
908fad0dc4
commit
b09bf0a900
11
Rakefile
11
Rakefile
|
@ -108,14 +108,13 @@ def gemfiles
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_each_gemfile
|
def with_each_gemfile
|
||||||
old_env = ENV['BUNDLE_GEMFILE']
|
|
||||||
gemfiles.each do |gemfile|
|
gemfiles.each do |gemfile|
|
||||||
puts "Using gemfile: #{gemfile}"
|
Bundler.with_clean_env do
|
||||||
ENV['BUNDLE_GEMFILE'] = gemfile
|
puts "Using gemfile: #{gemfile}"
|
||||||
yield
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
||||||
|
yield
|
||||||
|
end
|
||||||
end
|
end
|
||||||
ensure
|
|
||||||
ENV['BUNDLE_GEMFILE'] = old_env
|
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :test do
|
namespace :test do
|
||||||
|
|
Loading…
Reference in New Issue