diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 11ea8df672..ec86bd7941 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -11,7 +11,9 @@ raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent require "English" -$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) +unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) + $LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) +end require "global" require "tap" diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index ae1854f589..f688ef8e5a 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -77,6 +77,7 @@ RSpec.shared_context "integration test" do "HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args), "HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR, "HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"], + "GEM_HOME" => nil, ) ruby_args = [ @@ -89,7 +90,7 @@ RSpec.shared_context "integration test" do ruby_args << "-rtest/support/helper/integration_mocks" ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s - Bundler.with_original_env do + Bundler.with_clean_env do stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args) $stdout.print stdout $stderr.print stderr