homebrew-cask-versions/test/support/fake_dirs.rb
Roland Walker b40b0c99e1 strip constants from homebrew-fork global.rb
and corresponding testing_env.rb.
* recast HOMEBREW_BREW_FILE as Hbc.homebrew_executable,
  defined in Hbc::Locations
* recast HOMEBREW_REPOSITORY as Hbc.homebrew_repository
* recast HOMEBREW_PREFIX as Hbc.homebrew_prefix
* remove HOMEBREW_LIBRARY
* recast existing Hbc.tapspath as Hbc.homebrew_tapspath
  to match new methods

fixes #8705
2015-01-07 09:09:53 -05:00

29 lines
544 B
Ruby

# wire in a set of fake link dirs per-test
module FakeDirHooks
DIRS = [:appdir, :qlplugindir, :binarydir]
def before_setup
super
@canned_dirs = {}
DIRS.each do |dir_name|
dir = Hbc.homebrew_prefix.join("#{dir_name}-#{Time.now.to_i}-#{rand(1024)}")
dir.mkpath
Hbc.send("#{dir_name}=", dir)
@canned_dirs[:dir_name] = dir
end
end
def after_teardown
super
@canned_dirs.each_value do |dir|
dir.rmtree if dir.exist?
end
end
end
class MiniTest::Spec
include FakeDirHooks
end