Use Dir.mktmpdir to create temp directory for tests
This commit is contained in:
parent
8d12684efe
commit
43cb0b9141
@ -12,9 +12,13 @@ require 'extend/enumerable'
|
|||||||
require 'exceptions'
|
require 'exceptions'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
require 'tmpdir'
|
||||||
|
|
||||||
|
tmpdir = Dir.mktmpdir
|
||||||
|
at_exit { FileUtils.remove_entry(tmpdir) }
|
||||||
|
|
||||||
# Constants normally defined in global.rb
|
# Constants normally defined in global.rb
|
||||||
HOMEBREW_PREFIX = Pathname.new('/private/tmp/testbrew/prefix')
|
HOMEBREW_PREFIX = Pathname.new(tmpdir).join("prefix")
|
||||||
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
|
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
|
||||||
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
|
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
|
||||||
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
|
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
|
||||||
@ -48,8 +52,6 @@ ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p
|
|||||||
HOMEBREW_REPOSITORY.join(d).mkpath
|
HOMEBREW_REPOSITORY.join(d).mkpath
|
||||||
end
|
end
|
||||||
|
|
||||||
at_exit { HOMEBREW_PREFIX.parent.rmtree }
|
|
||||||
|
|
||||||
# Test fixtures and files can be found relative to this path
|
# Test fixtures and files can be found relative to this path
|
||||||
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
|
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user