diff options
| author | Mike McQuaid | 2014-04-01 22:26:54 -0500 |
|---|---|---|
| committer | Mike McQuaid | 2014-04-10 15:25:30 +0100 |
| commit | f6c6d0f60ec66a49761af9ebbea7c1da14ebcd52 (patch) | |
| tree | 722f98c8ab853c80536d410a367247a0fe4cb71d | |
| parent | e2fbfc83901fbd885c7a1cc1f471b0f3fe071c15 (diff) | |
| download | brew-f6c6d0f60ec66a49761af9ebbea7c1da14ebcd52.tar.bz2 | |
Add tests for new bottling hooks.
Closes Homebrew/homebrew#27890.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
| -rw-r--r-- | Library/Homebrew/test/test_bottle_hooks.rb | 40 |
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 |
