aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorDavid Porter2010-05-08 15:35:06 +1000
committerAdam Vandenberg2010-05-12 09:20:15 -0700
commit4da905b7fb61a48392aee18a8a2b0bf757cdab22 (patch)
tree019a01b2811b6699f66136e5b3ede0f31408d838 /Library/Homebrew/test
parent5f4871ba9df0e00daf042803d8945deba2534951 (diff)
downloadbrew-4da905b7fb61a48392aee18a8a2b0bf757cdab22.tar.bz2
Fix the update tests
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_updater.rb16
-rwxr-xr-xLibrary/Homebrew/test/tests6
2 files changed, 9 insertions, 13 deletions
diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb
index b94ec952a..1d733560b 100644
--- a/Library/Homebrew/test/test_updater.rb
+++ b/Library/Homebrew/test/test_updater.rb
@@ -23,6 +23,8 @@ class RefreshBrewMock < RefreshBrew
raise "#{inspect} Unexpectedly called backticks in pwd `#{HOMEBREW_PREFIX}' and command `#{cmd}'"
end
end
+
+ alias safe_system `
def expectations_met?
@expect.keys.sort == @called.sort
@@ -54,8 +56,8 @@ class UpdaterTests < Test::Unit::TestCase
def test_update_homebrew_without_any_changes
outside_prefix do
updater = RefreshBrewMock.new
- updater.in_prefix_expect("git checkout master")
- updater.in_prefix_expect("git pull origin master", "Already up-to-date.\n")
+ updater.in_prefix_expect(RefreshBrew::INIT_COMMAND)
+ updater.in_prefix_expect(RefreshBrew::UPDATE_COMMAND, "Already up-to-date.\n")
assert_equal false, updater.update_from_masterbrew!
assert updater.expectations_met?
@@ -67,9 +69,9 @@ class UpdaterTests < Test::Unit::TestCase
def test_update_homebrew_without_formulae_changes
outside_prefix do
updater = RefreshBrewMock.new
- updater.in_prefix_expect("git checkout master")
+ updater.in_prefix_expect(RefreshBrew::INIT_COMMAND)
output = fixture('update_git_pull_output_without_formulae_changes')
- updater.in_prefix_expect("git pull origin master", output)
+ updater.in_prefix_expect(RefreshBrew::UPDATE_COMMAND, output)
assert_equal true, updater.update_from_masterbrew!
assert !updater.pending_formulae_changes?
@@ -81,9 +83,9 @@ class UpdaterTests < Test::Unit::TestCase
def test_update_homebrew_with_formulae_changes
outside_prefix do
updater = RefreshBrewMock.new
- updater.in_prefix_expect("git checkout master")
+ updater.in_prefix_expect(RefreshBrew::INIT_COMMAND)
output = fixture('update_git_pull_output_with_formulae_changes')
- updater.in_prefix_expect("git pull origin master", output)
+ updater.in_prefix_expect(RefreshBrew::UPDATE_COMMAND, output)
assert_equal true, updater.update_from_masterbrew!
assert updater.pending_formulae_changes?
@@ -95,7 +97,7 @@ class UpdaterTests < Test::Unit::TestCase
def test_updater_returns_current_revision
outside_prefix do
updater = RefreshBrewMock.new
- updater.in_prefix_expect('git log -l -1 --pretty=format:%H', 'the-revision-hash')
+ updater.in_prefix_expect(RefreshBrew::REVISION_COMMAND, 'the-revision-hash')
assert_equal 'the-revision-hash', updater.current_revision
end
end
diff --git a/Library/Homebrew/test/tests b/Library/Homebrew/test/tests
index b292bb570..21cc9f17e 100755
--- a/Library/Homebrew/test/tests
+++ b/Library/Homebrew/test/tests
@@ -5,10 +5,6 @@
# Note: "formula_test" is omitted; these aren't unit tests but sanity checks
# on the real formulae.
#
-# Run as:
-# ./tests -- --skip-update
-# to omit the update tests which only seem to work for mxcl
-#
# Feel free to split out test_bucket
ruby test_bucket.rb $*
@@ -24,6 +20,4 @@ ruby test_pathname_install.rb $*
ruby test_utils.rb $*
ruby test_ARGV.rb $*
ruby test_ENV.rb $*
-
-# Update tests (only seem to work for mxcl)
ruby test_updater.rb $*