aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-10-29 23:49:52 -0500
committerJack Nagel2014-10-29 23:49:57 -0500
commit503d7811508af80d20d767f0206250bf9f3c1a47 (patch)
treed6487d200c5dacee23aee8e2229bdfd8f5c8ea85 /Library
parent1a487fa2b3e122a15b961099e3494ce5821286c5 (diff)
downloadbrew-503d7811508af80d20d767f0206250bf9f3c1a47.tar.bz2
Allow tests to reset bottle hooks on teardown
This avoids polluting other tests that might invoke the installer, thus executing any registered hooks.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/hooks/bottles.rb4
-rw-r--r--Library/Homebrew/test/test_bottle_hooks.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/hooks/bottles.rb b/Library/Homebrew/hooks/bottles.rb
index de321c09a..6f6ce7e47 100644
--- a/Library/Homebrew/hooks/bottles.rb
+++ b/Library/Homebrew/hooks/bottles.rb
@@ -26,6 +26,10 @@ module Homebrew
return false unless @pour_bottle
@pour_bottle.call formula
end
+
+ def self.reset_hooks
+ @has_bottle = @pour_bottle = nil
+ end
end
end
end
diff --git a/Library/Homebrew/test/test_bottle_hooks.rb b/Library/Homebrew/test/test_bottle_hooks.rb
index 8c66bce53..92dca6dff 100644
--- a/Library/Homebrew/test/test_bottle_hooks.rb
+++ b/Library/Homebrew/test/test_bottle_hooks.rb
@@ -37,4 +37,8 @@ class BottleHookTests < Homebrew::TestCase
end
@fi.pour
end
+
+ def teardown
+ Homebrew::Hooks::Bottles.reset_hooks
+ end
end