diff --git a/Library/Homebrew/test/cmd/cask_spec.rb b/Library/Homebrew/test/cmd/cask_spec.rb index 0692e815a3..0bc178cc59 100644 --- a/Library/Homebrew/test/cmd/cask_spec.rb +++ b/Library/Homebrew/test/cmd/cask_spec.rb @@ -1,7 +1,7 @@ describe "brew cask", :integration_test, :needs_macos, :needs_network do describe "list" do it "returns a list of installed Casks" do - setup_remote_tap("homebrew/cask") + setup_remote_tap "homebrew/cask" expect { brew "cask", "list" }.to be_a_success end 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 2937c60f74..e2e518c6c1 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 @@ -174,7 +174,16 @@ RSpec.shared_context "integration test" do def setup_remote_tap(name) Tap.fetch(name).tap do |tap| - tap.install(full_clone: false, quiet: true) unless tap.installed? + next if tap.installed? + full_name = Tap.fetch(name).full_name + # Check to see if the original Homebrew process has taps we can use. + system_tap_path = Pathname("#{ENV["HOMEBREW_LIBRARY"]}/Taps/#{full_name}") + if system_tap_path.exist? + system "git", "clone", "--shared", system_tap_path, tap.path + system "git", "-C", tap.path, "checkout", "master" + else + tap.install(full_clone: false, quiet: true) + end end end