diff --git a/Library/Homebrew/test/cask/upgrade_spec.rb b/Library/Homebrew/test/cask/upgrade_spec.rb index 374c289634..35df63722f 100644 --- a/Library/Homebrew/test/cask/upgrade_spec.rb +++ b/Library/Homebrew/test/cask/upgrade_spec.rb @@ -25,7 +25,6 @@ describe Cask::Upgrade, :cask do installed.each do |cask| Cask::Installer.new(Cask::CaskLoader.load(cask_path(cask))).install end - FileUtils.rm_rf CoreCaskTap.instance.cask_dir/"outdated" allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) end diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 67f9078c95..798cf246c6 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -39,9 +39,16 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do # rubocop:disable RSpec/Co Cask::Config::DEFAULT_DIRS_PATHNAMES.each_value(&:mkpath) CoreCaskTap.instance.tap do |tap| - tap.cask_dir.mkpath - (TEST_FIXTURE_DIR/"cask/Casks").children.each do |casks_path| - FileUtils.ln_sf casks_path, tap.cask_dir + fixture_cask_dir = TEST_FIXTURE_DIR/"cask/Casks" + fixture_cask_dir.glob("**/*.rb").each do |fixture_cask_path| + relative_cask_path = fixture_cask_path.relative_path_from(fixture_cask_dir) + + # These are only used manually in tests since they + # would otherwise conflict with other casks. + next if relative_cask_path.dirname.basename.to_s == "outdated" + + cask_dir = (tap.cask_dir/relative_cask_path.dirname).tap(&:mkpath) + FileUtils.ln_sf fixture_cask_path, cask_dir end end