From 55831647fbea0005449f714eec7672fab50cf9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 23 Jul 2019 08:14:02 +0200 Subject: [bundler/bundler] Move environment reset to the only test needing it https://github.com/bundler/bundler/commit/6d3b809695 --- spec/bundler/runtime/with_unbundled_env_spec.rb | 2 ++ spec/bundler/spec_helper.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb index f78cdb5876..b346df6283 100644 --- a/spec/bundler/runtime/with_unbundled_env_spec.rb +++ b/spec/bundler/runtime/with_unbundled_env_spec.rb @@ -54,6 +54,8 @@ RSpec.describe "Bundler.with_env helpers" do end it "removes variables that bundler added", :ruby_repo do + ENV.replace(ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) }) + original = ruby!('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")') code = 'puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")' bundle_exec_ruby! code.dump diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index 2580187402..e3af0f55d2 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -78,7 +78,7 @@ RSpec.configure do |config| config.filter_run_when_matching :focus unless ENV["CI"] original_wd = Dir.pwd - original_env = ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) } + original_env = ENV.to_hash config.expect_with :rspec do |c| c.syntax = :expect @@ -105,7 +105,7 @@ RSpec.configure do |config| # Don't wrap output in tests ENV["THOR_COLUMNS"] = "10000" - original_env = ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) } + original_env = ENV.to_hash if ENV["BUNDLE_RUBY"] FileUtils.cp_r Spec::Path.bindir, File.join(Spec::Path.root, "lib", "exe") -- cgit v1.2.3