aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2013-01-22 14:33:33 -0600
committerJack Nagel2013-01-22 14:59:10 -0600
commit3725f771de576ca7324fd566678e3416e270a8a7 (patch)
tree5d8742e0cb381b71ea0d561b50281da5e0d04b71 /Library/Homebrew/test
parentb9e5f1229b61f1e4b90e742f50b267df8a758633 (diff)
downloadbrew-3725f771de576ca7324fd566678e3416e270a8a7.tar.bz2
Infer path to be added for requirements that search PATH
When a requirement is specified like: satisfy { which "foo" } There is no reason that we should inject all of ENV.userpaths! into the build environment. Instead, infer the directory to be added to PATH from the Pathname that is returned. This is another step towards condensing the "which program" requirements down into a one-liner DSL element.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_requirement.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_requirement.rb b/Library/Homebrew/test/test_requirement.rb
index 0319e9e25..e8803ed92 100644
--- a/Library/Homebrew/test/test_requirement.rb
+++ b/Library/Homebrew/test/test_requirement.rb
@@ -74,4 +74,17 @@ class RequirementTests < Test::Unit::TestCase
assert req.satisfied?
end
+
+ def test_infers_path_from_satisfy_result
+ which_path = Pathname.new("/foo/bar/baz")
+ req = Class.new(Requirement) do
+ satisfy { which_path }
+ end.new
+
+ ENV.expects(:with_build_environment).yields.returns(which_path)
+ ENV.expects(:userpaths!)
+ ENV.expects(:append).with("PATH", which_path.parent, ":")
+
+ req.modify_build_environment
+ end
end