From d6b70bc447a0fd5b79e0ed9e4cc64357510254e0 Mon Sep 17 00:00:00 2001 From: buty4649 Date: Tue, 31 Oct 2023 22:36:00 +0900 Subject: [PATCH] Fix acl on windows --- spec/error_message_spec.rb | 10 +++++++++- spec/spec_helper.rb | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/error_message_spec.rb b/spec/error_message_spec.rb index d38658f..1dfb270 100644 --- a/spec/error_message_spec.rb +++ b/spec/error_message_spec.rb @@ -96,8 +96,16 @@ before do touch(file) - chmod(0o000, file) + if windows? + # drop all permissions + `icacls #{file} /inheritancelevel:r` + else + chmod(0o000, file) + end run_rf("_ #{file}") + + # restore permissions + `icalcs #{file} /inheritancelevel:e` if windows? end it { expect(last_command_started).not_to be_successfully_executed } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c3490be..6cdb70a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,3 +15,7 @@ def load_fixture(path) config.include Aruba::Api config.before { setup_aruba } end + +def windows? + /mswin(?!ce)|mingw|cygwin|bccwin/.match?(RUBY_PLATFORM) +end