bsdcontrol.rb/test/superuser/enable_feature_test.rb

37 lines
820 B
Ruby
Raw Normal View History

2024-03-08 00:27:20 +01:00
require_relative "../setup"
module BSD::Control
class EnableFeatureTest < Test::Unit::TestCase
require 'fileutils'
include FileUtils
def test_enable_pageexec
2024-03-08 00:27:20 +01:00
touch(file)
assert BSD::Control.feature(:pageexec).enable!(file),
2024-03-08 00:27:20 +01:00
"The enable! method should have returned true"
ensure
rm(file)
end
def test_enable_pageexec_zero_permissions
2024-03-08 02:28:48 +01:00
touch(file)
chmod(0, file)
assert BSD::Control.feature(:pageexec).enable!(file),
2024-03-08 02:28:48 +01:00
"The enable! method should have returned true"
ensure
rm(file)
end
def test_enable_pageexec_nonexistent_file
2024-03-09 23:40:42 +01:00
assert_raises(Errno::ENOENT) do
BSD::Control.feature(:pageexec).enable!(file)
2024-03-08 00:27:20 +01:00
end
end
private
def file
File.join(__dir__, "file")
end
end
end