From 503d7811508af80d20d767f0206250bf9f3c1a47 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 29 Oct 2014 23:49:52 -0500 Subject: Allow tests to reset bottle hooks on teardown This avoids polluting other tests that might invoke the installer, thus executing any registered hooks. --- Library/Homebrew/hooks/bottles.rb | 4 ++++ Library/Homebrew/test/test_bottle_hooks.rb | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'Library') 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 -- cgit v1.2.3