blob: 2cf9c51063f06f8b4587e42d4b7c03d41a65a5b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
end
|