setup_remote_tap: use system taps.

This saves recloning the taps we use multiple times when already done by
the user.
This commit is contained in:
Mike McQuaid 2018-10-03 19:14:04 +01:00
parent 8f03ea7ca9
commit ac2aabf287
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 11 additions and 2 deletions

View File

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

View File

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