aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-02-12 14:56:01 -0800
committerAdam Vandenberg2010-04-06 08:27:10 -0700
commit9d127ac3d58f99a744fe017f89ca64dcaeeed778 (patch)
treef4c5f68748d1133516bd7a1918587bca99eeab83 /Library
parentfd453107c6bade4320ca7bafcc7707eef24ce01e (diff)
downloadbrew-9d127ac3d58f99a744fe017f89ca64dcaeeed778.tar.bz2
Move updater tests to separate file.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_updater.rb35
-rwxr-xr-xLibrary/Homebrew/test/tests3
-rwxr-xr-xLibrary/Homebrew/test/unittest.rb26
3 files changed, 38 insertions, 26 deletions
diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb
index 893589983..b94ec952a 100644
--- a/Library/Homebrew/test/test_updater.rb
+++ b/Library/Homebrew/test/test_updater.rb
@@ -1,3 +1,38 @@
+abort if ARGV.include? "--skip-update"
+
+require 'testing_env'
+
+require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser
+ARGV.extend(HomebrewArgvExtension)
+
+require 'formula'
+require 'utils'
+require 'update'
+
+class RefreshBrewMock < RefreshBrew
+ def in_prefix_expect(expect, returns = '')
+ @expect ||= {}
+ @expect[expect] = returns
+ end
+
+ def `(cmd)
+ if Dir.pwd == HOMEBREW_PREFIX.to_s and @expect.has_key?(cmd)
+ (@called ||= []) << cmd
+ @expect[cmd]
+ else
+ raise "#{inspect} Unexpectedly called backticks in pwd `#{HOMEBREW_PREFIX}' and command `#{cmd}'"
+ end
+ end
+
+ def expectations_met?
+ @expect.keys.sort == @called.sort
+ end
+
+ def inspect
+ "#<#{self.class.name} #{object_id}>"
+ end
+end
+
class UpdaterTests < Test::Unit::TestCase
OUTSIDE_PREFIX = '/tmp'
def outside_prefix
diff --git a/Library/Homebrew/test/tests b/Library/Homebrew/test/tests
index a63d5be35..64aaf3109 100755
--- a/Library/Homebrew/test/tests
+++ b/Library/Homebrew/test/tests
@@ -9,6 +9,9 @@
# Bulk of the tests
ruby unittest.rb $*
+# Update tests (only seem to work for mxcl)
+ruby test_updater.rb $*
+
# Patching tests
ruby test_patching.rb $*
diff --git a/Library/Homebrew/test/unittest.rb b/Library/Homebrew/test/unittest.rb
index 8dd298563..49d6f6ad7 100755
--- a/Library/Homebrew/test/unittest.rb
+++ b/Library/Homebrew/test/unittest.rb
@@ -30,7 +30,6 @@ require 'keg'
require 'utils'
require 'brew.h'
require 'hardware'
-require 'update'
# for some reason our utils.rb safe_system behaves completely differently
# during these tests. This is worrying for sure.
@@ -113,30 +112,6 @@ class TestScriptFileFormula <ScriptFileFormula
end
end
-class RefreshBrewMock < RefreshBrew
- def in_prefix_expect(expect, returns = '')
- @expect ||= {}
- @expect[expect] = returns
- end
-
- def `(cmd)
- if Dir.pwd == HOMEBREW_PREFIX.to_s and @expect.has_key?(cmd)
- (@called ||= []) << cmd
- @expect[cmd]
- else
- raise "#{inspect} Unexpectedly called backticks in pwd `#{HOMEBREW_PREFIX}' and command `#{cmd}'"
- end
- end
-
- def expectations_met?
- @expect.keys.sort == @called.sort
- end
-
- def inspect
- "#<#{self.class.name} #{object_id}>"
- end
-end
-
module ExtendArgvPlusYeast
def reset
@named = nil
@@ -150,6 +125,5 @@ ARGV.extend ExtendArgvPlusYeast
require 'test/test_versions'
require 'test/test_checksums'
-require 'test/test_updater' unless ARGV.include? "--skip-update"
require 'test/test_bucket'
require 'test/test_inreplace'