aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-10-29 23:49:52 -0500
committerJack Nagel2014-10-29 23:49:57 -0500
commit60d4c157306c6d9a40cae4a02a094f92f18576b0 (patch)
tree29e4f00b130e4a27db8a57ba0ff83f785d0b9991
parent870c8fa4d991ec0fd96ad6ed9687751f3d2798df (diff)
downloadhomebrew-60d4c157306c6d9a40cae4a02a094f92f18576b0.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.
-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