Simplify Cask spec_helper.

This commit is contained in:
Markus Reiter 2017-03-04 20:02:40 +01:00
parent 370c711da2
commit a1fbb1020b
2 changed files with 5 additions and 8 deletions

View File

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

View File

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