diff options
| author | Adam Vandenberg | 2010-02-12 14:56:01 -0800 |
|---|---|---|
| committer | Adam Vandenberg | 2010-04-06 08:27:10 -0700 |
| commit | 9d127ac3d58f99a744fe017f89ca64dcaeeed778 (patch) | |
| tree | f4c5f68748d1133516bd7a1918587bca99eeab83 /Library/Homebrew/test/test_updater.rb | |
| parent | fd453107c6bade4320ca7bafcc7707eef24ce01e (diff) | |
| download | brew-9d127ac3d58f99a744fe017f89ca64dcaeeed778.tar.bz2 | |
Move updater tests to separate file.
Diffstat (limited to 'Library/Homebrew/test/test_updater.rb')
| -rw-r--r-- | Library/Homebrew/test/test_updater.rb | 35 |
1 files changed, 35 insertions, 0 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 |
