aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMike McQuaid2016-08-17 08:30:16 +0100
committerGitHub2016-08-17 08:30:16 +0100
commit2ab5c77d0ca82581658370ac899a8464a70ec159 (patch)
tree6798ab00d65be0dc8706bf0e2b3afb56999ecc9a /Library/Homebrew/test
parent823505a0584f5b114ebb29b3d66c5a1ca5ed399b (diff)
parentc6151951d6b685936adb8819db3957b12c95f5c9 (diff)
downloadbrew-2ab5c77d0ca82581658370ac899a8464a70ec159.tar.bz2
Merge pull request #713 from MikeMcQuaid/ship-sandbox
Enable sandbox by default for homebrew/core
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_sandbox.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb
index dc907d428..cb33c3ffa 100644
--- a/Library/Homebrew/test/test_sandbox.rb
+++ b/Library/Homebrew/test/test_sandbox.rb
@@ -13,6 +13,28 @@ class SandboxTest < Homebrew::TestCase
@dir.rmtree
end
+ def test_formula?
+ f = formula { url "foo-1.0" }
+ f2 = formula { url "bar-1.0" }
+ f2.stubs(:tap).returns(Tap.fetch("test/tap"))
+
+ ARGV.stubs(:sandbox?).returns true
+ assert Sandbox.formula?(f),
+ "Formulae should be sandboxed if --sandbox was passed."
+
+ ARGV.stubs(:sandbox?).returns false
+ assert Sandbox.formula?(f),
+ "Formulae should be sandboxed if in a sandboxed tap."
+ refute Sandbox.formula?(f2),
+ "Formulae should not be sandboxed if not in a sandboxed tap."
+ end
+
+ def test_test?
+ ARGV.stubs(:no_sandbox?).returns false
+ assert Sandbox.test?,
+ "Tests should be sandboxed unless --no-sandbox was passed."
+ end
+
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file