aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMike McQuaid2015-07-09 12:33:31 +0100
committerMike McQuaid2015-07-09 12:33:31 +0100
commitb11ae2abdcb1ab91000109a4852f92ba2de0c285 (patch)
treee5a32f36f634fc14b208f9a4e9f9a8b9c79faf3e /Library/Homebrew/test
parent7c890261ac500da49acd801aebe244d9d12f93e3 (diff)
downloadbrew-b11ae2abdcb1ab91000109a4852f92ba2de0c285.tar.bz2
update: stash save/pop uncommitted changes.
Also: - return to your previous branch after `brew update`. Closes Homebrew/homebrew#38568. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_updater.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb
index c9f7ea4b8..849095833 100644
--- a/Library/Homebrew/test/test_updater.rb
+++ b/Library/Homebrew/test/test_updater.rb
@@ -5,7 +5,7 @@ require 'yaml'
class UpdaterTests < Homebrew::TestCase
class UpdaterMock < ::Updater
- attr_accessor :diff
+ attr_accessor :diff, :expected, :called
def initialize(*)
super
@@ -29,10 +29,7 @@ class UpdaterTests < Homebrew::TestCase
end
end
alias_method :safe_system, :`
-
- def expectations_met?
- @expected == @called
- end
+ alias_method :system, :`
def inspect
"#<#{self.class.name}>"
@@ -60,14 +57,15 @@ class UpdaterTests < Homebrew::TestCase
Formulary.stubs(:factory).returns(stub(:pkg_version => "1.0"))
FormulaVersions.stubs(:new).returns(stub(:formula_at_revision => "2.0"))
@updater.diff = fixture(fixture_name)
- @updater.in_repo_expect("git checkout -q master")
+ @updater.in_repo_expect("git diff --quiet", true)
+ @updater.in_repo_expect("git symbolic-ref --short HEAD", "master")
@updater.in_repo_expect("git rev-parse -q --verify HEAD", "1234abcd")
@updater.in_repo_expect("git config core.autocrlf false")
- @updater.in_repo_expect("git pull -q origin refs/heads/master:refs/remotes/origin/master")
+ @updater.in_repo_expect("git pull origin refs/heads/master:refs/remotes/origin/master --quiet")
@updater.in_repo_expect("git rev-parse -q --verify HEAD", "3456cdef")
- @updater.pull!
+ @updater.pull!(:silent => true)
@report.update(@updater.report)
- assert_predicate @updater, :expectations_met?
+ assert_equal @updater.expected, @updater.called
end
def test_update_homebrew_without_any_changes