Use constant array of constants in Homebrew::TestCase.

This commit is contained in:
Markus Reiter 2017-01-26 00:52:21 +01:00
parent f35c6c8cf1
commit b765853969

View File

@ -12,16 +12,18 @@ module Homebrew
TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
TEST_DIRECTORIES = [
CoreTap.instance.path/"Formula",
HOMEBREW_CACHE,
HOMEBREW_CACHE_FORMULA,
HOMEBREW_CELLAR,
HOMEBREW_LOCK_DIR,
HOMEBREW_LOGS,
HOMEBREW_TEMP,
].freeze
def setup
[
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula",
HOMEBREW_CACHE,
HOMEBREW_CACHE_FORMULA,
HOMEBREW_LOCK_DIR,
HOMEBREW_CELLAR,
HOMEBREW_LOGS,
HOMEBREW_TEMP,
].each(&:mkpath)
TEST_DIRECTORIES.each(&:mkpath)
super
@ -35,15 +37,10 @@ module Homebrew
Tab.clear_cache
coretap = CoreTap.new
paths_to_delete = [
FileUtils.rm_rf [
TEST_DIRECTORIES.map(&:children),
HOMEBREW_LINKED_KEGS,
HOMEBREW_PINNED_KEGS,
HOMEBREW_CELLAR.children,
HOMEBREW_CACHE.children,
HOMEBREW_LOCK_DIR.children,
HOMEBREW_LOGS.children,
HOMEBREW_TEMP.children,
HOMEBREW_PREFIX/".git",
HOMEBREW_PREFIX/"bin",
HOMEBREW_PREFIX/"share",
@ -55,12 +52,10 @@ module Homebrew
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-services",
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-shallow",
HOMEBREW_REPOSITORY/".git",
coretap.path/".git",
coretap.alias_dir,
coretap.formula_dir.children,
coretap.path/"formula_renames.json",
].flatten
FileUtils.rm_rf paths_to_delete
CoreTap.instance.path/".git",
CoreTap.instance.alias_dir,
CoreTap.instance.path/"formula_renames.json",
]
super
end