From c85df70757f6768469f1d74fe4068bc0540163fe Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 27 Apr 2020 15:04:54 +0200 Subject: [PATCH] Fix flaw in Cask test helper This commit fixes a flaw in the Cask test helper, causing the broken `Cask::Config` test to actually fail. The flaw occurred while patching the `Cask::Config::DEFAULT_DIRS` hash. While the original hash uses strings as values, the patched one used `Pathname` values, masking a broken `Cask::Config::from_json` test. Now the broken test fails like it should. --- .../support/helper/spec/shared_context/homebrew_cask.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 290ec50b81..e0b01d9afe 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 @@ -10,7 +10,7 @@ module Cask class Config remove_const :DEFAULT_DIRS - DEFAULT_DIRS = { + DEFAULT_DIRS_PATHNAMES = { appdir: Pathname(TEST_TMPDIR)/"cask-appdir", prefpanedir: Pathname(TEST_TMPDIR)/"cask-prefpanedir", qlplugindir: Pathname(TEST_TMPDIR)/"cask-qlplugindir", @@ -26,6 +26,8 @@ module Cask vst3_plugindir: Pathname(TEST_TMPDIR)/"cask-vst3_plugindir", screen_saverdir: Pathname(TEST_TMPDIR)/"cask-screen_saverdir", }.freeze + + DEFAULT_DIRS = DEFAULT_DIRS_PATHNAMES.transform_values(&:to_s).freeze end end @@ -34,7 +36,7 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do third_party_tap = Tap.fetch("third-party", "tap") begin - Cask::Config::DEFAULT_DIRS.values.each(&:mkpath) + Cask::Config::DEFAULT_DIRS_PATHNAMES.values.each(&:mkpath) Cask::Config.global.binarydir.mkpath Tap.default_cask_tap.tap do |tap|