28 lines
588 B
Ruby
28 lines
588 B
Ruby
|
require_relative "../setup"
|
||
|
module BSD::Control
|
||
|
class EnableFeatureTest < Test::Unit::TestCase
|
||
|
require 'fileutils'
|
||
|
include FileUtils
|
||
|
|
||
|
def test_enable_mprotect
|
||
|
touch(file)
|
||
|
assert BSD::Control.feature!(:mprotect).enable!(file),
|
||
|
"The enable! method should have returned true"
|
||
|
ensure
|
||
|
rm(file)
|
||
|
end
|
||
|
|
||
|
def test_enable_mprotect_nonexistent_file
|
||
|
assert_raises(BSD::Control::Error) do
|
||
|
BSD::Control.feature!(:mprotect).enable!(file)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def file
|
||
|
File.join(__dir__, "file")
|
||
|
end
|
||
|
end
|
||
|
end
|