From c6fa3fe8b416a41c698188269c3f587c3ad107d1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 19 Jul 2018 12:45:35 +0200 Subject: [PATCH] Add test for basename in `#extract_nestedly`. --- Library/Homebrew/test/unpack_strategy_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Library/Homebrew/test/unpack_strategy_spec.rb b/Library/Homebrew/test/unpack_strategy_spec.rb index 1eb9dc3b52..a55c0cdb0b 100644 --- a/Library/Homebrew/test/unpack_strategy_spec.rb +++ b/Library/Homebrew/test/unpack_strategy_spec.rb @@ -56,6 +56,23 @@ describe UnpackStrategy do expect(Pathname.glob(unpack_dir/"**/*")).to include unpack_dir/directories end end + + context "when extracting a nested archive" do + let(:basename) { "file.xyz" } + let(:path) { + (mktmpdir/basename).tap do |path| + mktmpdir do |dir| + FileUtils.touch dir/"file.txt" + system "tar", "-c", "-f", path, "-C", dir, "file.txt" + end + end + } + + it "does not pass down the basename of the archive" do + strategy.extract_nestedly(to: unpack_dir) + expect(unpack_dir/"file.txt").to be_a_file + end + end end end