From b675024ce0bec75c74b46224efb8b38b1576a4ac Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 22 Jul 2018 18:11:41 +0200 Subject: [PATCH] Add failing test for `DirectoryUnpackStrategy`. --- Library/Homebrew/test/unpack_strategy_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Library/Homebrew/test/unpack_strategy_spec.rb b/Library/Homebrew/test/unpack_strategy_spec.rb index 14174a7ff1..a2a3e5a3c1 100644 --- a/Library/Homebrew/test/unpack_strategy_spec.rb +++ b/Library/Homebrew/test/unpack_strategy_spec.rb @@ -90,6 +90,21 @@ describe DirectoryUnpackStrategy do strategy.extract(to: unpack_dir) expect(unpack_dir/"symlink").to be_a_symlink end + + it "preserves permissions of contained files" do + FileUtils.chmod 0644, path/"file" + + strategy.extract(to: unpack_dir) + expect((unpack_dir/"file").stat.mode & 0777).to eq 0644 + end + + it "preserves the permissions of the destination directory" do + FileUtils.chmod 0700, path + FileUtils.chmod 0755, unpack_dir + + strategy.extract(to: unpack_dir) + expect(unpack_dir.stat.mode & 0777).to eq 0755 + end end describe UncompressedUnpackStrategy do