From a1fbb1020bdfa5cad0659b466c4b236c7d37c789 Mon Sep 17 00:00:00 2001 From: Markus Reiter <me@reitermark.us> Date: Sat, 4 Mar 2017 20:02:40 +0100 Subject: [PATCH] Simplify Cask `spec_helper`. --- Library/Homebrew/cask/lib/hbc/locations.rb | 8 ++++---- Library/Homebrew/cask/spec/spec_helper.rb | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb index 292b45d0ca..4fb4a21914 100644 --- a/Library/Homebrew/cask/lib/hbc/locations.rb +++ b/Library/Homebrew/cask/lib/hbc/locations.rb @@ -15,6 +15,8 @@ module Hbc @default_caskroom ||= HOMEBREW_PREFIX.join("Caskroom") end + attr_writer :caskroom + def caskroom @caskroom ||= begin if Utils.path_occupied?(legacy_caskroom) @@ -36,14 +38,12 @@ module Hbc end end - def caskroom=(caskroom) - @caskroom = caskroom - end - def legacy_cache @legacy_cache ||= HOMEBREW_CACHE.join("Casks") end + attr_writer :cache + def cache @cache ||= HOMEBREW_CACHE.join("Cask") end diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/cask/spec/spec_helper.rb index ea6a87f417..f7f3dbf41d 100644 --- a/Library/Homebrew/cask/spec/spec_helper.rb +++ b/Library/Homebrew/cask/spec/spec_helper.rb @@ -1,4 +1,3 @@ -require "pathname" require "rspec/its" require "rspec/wait" @@ -22,9 +21,6 @@ Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "**", "*.rb" require "hbc" # create and override default directories -Hbc.appdir = Pathname.new(TEST_TMPDIR).join("Applications").tap(&:mkpath) -Hbc.cache.mkpath -Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath) Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap| # link test casks FileUtils.mkdir_p tap.path.dirname @@ -37,6 +33,7 @@ FileUtils.ln_s Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "h HOMEBREW_CASK_DIRS = [ :appdir, :caskroom, + :cache, :prefpanedir, :qlplugindir, :servicedir, -- GitLab