From 26ec9f9ea08978d15e329c3cb4d1df738be466e0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 9 Jan 2016 11:06:17 +0000 Subject: formula: add new pour_bottle DSL with reason. This allows there to be a user-visible description of why a bottle is not being installed. --- Library/Homebrew/test/test_formula.rb | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 8f372f6f7..312b8245d 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -367,4 +367,42 @@ class FormulaTests < Homebrew::TestCase [f1, f2, f3].each(&:clear_cache) f3.rack.rmtree end + + def test_pour_bottle + f_false = formula("foo") do + url "foo-1.0" + def pour_bottle? + false + end + end + refute f_false.pour_bottle? + + f_true = formula("foo") do + url "foo-1.0" + def pour_bottle? + true + end + end + assert f_true.pour_bottle? + end + + def test_pour_bottle_dsl + f_false = formula("foo") do + url "foo-1.0" + pour_bottle? do + reason "false reason" + satisfy { var == etc } + end + end + refute f_false.pour_bottle? + + f_true = formula("foo") do + url "foo-1.0" + pour_bottle? do + reason "true reason" + satisfy { var == var } + end + end + assert f_true.pour_bottle? + end end -- cgit v1.2.3