Handle failures in temporary_install better

This commit is contained in:
Jack Nagel 2014-06-12 21:33:55 -05:00
parent 1beefdb5d0
commit 4c0d2c2bfb

View File

@ -10,21 +10,20 @@ class InstallTests < Test::Unit::TestCase
end end
def temporary_install f def temporary_install f
# Brew and install the given formula f.prefix.mkpath
keg = Keg.new(f.prefix)
shutup do shutup do
f.brew { f.install } f.brew { f.install }
end end
# Allow the test to do some processing begin
yield yield
ensure
keg.unlink
keg.uninstall
end
# Remove the brewed formula and double check
# that it did get removed. This lets multiple
# tests use the same formula name without
# stepping on each other.
keg=Keg.new f.prefix
keg.unlink
keg.uninstall
assert !keg.exist? assert !keg.exist?
assert !f.installed? assert !f.installed?
end end