26 lines
496 B
Ruby
26 lines
496 B
Ruby
|
require_relative "../setup"
|
||
|
module BSD::Control
|
||
|
class EnableFeatureTest < Test::Unit::TestCase
|
||
|
require "fileutils"
|
||
|
include FileUtils
|
||
|
|
||
|
def test_enable_feature_lacks_privileges
|
||
|
touch(file)
|
||
|
assert_raises(
|
||
|
BSD::Control::Error,
|
||
|
"This operation requires root privileges."
|
||
|
) do
|
||
|
BSD::Control.feature!(:mprotect).enable!(file)
|
||
|
end
|
||
|
ensure
|
||
|
rm(file)
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def file
|
||
|
File.join(__dir__, "file")
|
||
|
end
|
||
|
end
|
||
|
end
|