aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/unittest.rb
diff options
context:
space:
mode:
authorMax Howell2009-07-31 02:51:17 +0100
committerMax Howell2009-07-31 04:59:02 +0100
commit118b41bfcdb13a4fec8da48e35de162ac62fe65c (patch)
treec9fdffd72da6a8a53b5fac4529aefaf7f7df4129 /Library/Homebrew/unittest.rb
parent1d4e18988019e14e90646018072f83e988531820 (diff)
downloadhomebrew-118b41bfcdb13a4fec8da48e35de162ac62fe65c.tar.bz2
Refactor $foo into HOMEBREW_FOO
CONSTANTS are the far saner choice for these important parameters. Split env up so I can redefine the CONSTANTS in unittest.rb.
Diffstat (limited to 'Library/Homebrew/unittest.rb')
-rwxr-xr-xLibrary/Homebrew/unittest.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 7b15b2949..dcaf036de 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -1,9 +1,16 @@
#!/usr/bin/ruby
-
$:.unshift File.dirname(__FILE__)
-require 'test/unit'
require 'formula'
+require 'pathname+yeast'
require 'stringio'
+require 'test/unit'
+require 'utils'
+
+# these are defined in env usually, but we want a fake place for everything init
+HOMEBREW_VERSION='1t'
+HOMEBREW_CACHE="/tmp/testbrew"
+HOMEBREW_PREFIX=Pathname.new(HOMEBREW_CACHE)+'prefix'
+HOMEBREW_CELLAR=Pathname.new(HOMEBREW_CACHE)+'cellar'
class TestFormula <Formula
def initialize url, md5='nomd5'
@@ -112,7 +119,7 @@ class BeerTasting <Test::Unit::TestCase
nostdout do
TestFormula.new(url, md5).brew do |f|
- assert_equal File.expand_path(f.prefix), ($cellar+f.name+'0.1').to_s
+ assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s
assert_kind_of Pathname, f.prefix
end
end