aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMike McQuaid2016-01-09 11:06:17 +0000
committerMike McQuaid2016-02-18 10:21:20 +0000
commit26ec9f9ea08978d15e329c3cb4d1df738be466e0 (patch)
treed3a3d774af9c94dcbcbe43e85c109b3f433346ba /Library/Homebrew/test
parent74858b28c5c66a792718b2b3d694ce8dc4144857 (diff)
downloadbrew-26ec9f9ea08978d15e329c3cb4d1df738be466e0.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_formula.rb38
1 files changed, 38 insertions, 0 deletions
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