aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2014-04-01 22:26:54 -0500
committerMike McQuaid2014-04-10 15:25:30 +0100
commit21b1e63285a5c74cb07bfe54e988fbd64bf87768 (patch)
tree117d04e7b30af01be95f6af9ecc6ca65b5139bf0 /Library
parentdc29fe38384740e66484dff862593e962be12889 (diff)
downloadhomebrew-21b1e63285a5c74cb07bfe54e988fbd64bf87768.tar.bz2
Add tests for new bottling hooks.
Closes #27890. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_bottle_hooks.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_bottle_hooks.rb b/Library/Homebrew/test/test_bottle_hooks.rb
new file mode 100644
index 000000000..9e28784c2
--- /dev/null
+++ b/Library/Homebrew/test/test_bottle_hooks.rb
@@ -0,0 +1,40 @@
+require 'testing_env'
+require 'formula_installer'
+require 'hooks/bottles'
+
+class BottleHookTests < Test::Unit::TestCase
+ class FormulaDouble
+ def bottle; end
+ def local_bottle_path; end
+ def some_random_method; true; end
+ end
+
+ def setup
+ @fi = FormulaInstaller.new FormulaDouble.new
+ end
+
+ def test_has_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ f.some_random_method
+ end
+ assert_equal true, @fi.pour_bottle?
+ end
+
+ def test_has_no_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ !f.some_random_method
+ end
+ assert_equal false, @fi.pour_bottle?
+ end
+
+ def test_pour_formula_bottle
+ Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
+ true
+ end
+
+ Homebrew::Hooks::Bottles.setup_pour_formula_bottle do |f|
+ f.some_random_method
+ end
+ @fi.pour
+ end
+end