diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb index 05af462dc57e2aee4e1e4c60c01f30e7a2048926..e3595621d71906d7734282f56eb7744e9787112f 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb @@ -271,15 +271,23 @@ describe Hbc::Artifact::Uninstall do context "when using rmdir" do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-rmdir.rb") } - let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") } + let(:empty_directory_path) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + + before(:each) do + empty_directory_path.mkdir + end + + after(:each) do + empty_directory_path.rmdir + end it "can uninstall" do Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rm -f --], dir_pathname.join(".DS_Store")), + sudo(%w[/bin/rm -f --], empty_directory_path/".DS_Store"), ) Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rmdir --], dir_pathname), + sudo(%w[/bin/rmdir --], empty_directory_path), ) subject diff --git a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb index b87b6ce1c2ea1c4f3b04c653473f46568b48a592..c49cebbb89466e1088e4edca51bc96a241f7962b 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb @@ -272,15 +272,23 @@ describe Hbc::Artifact::Zap do context "when using rmdir" do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-rmdir.rb") } - let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") } + let(:empty_directory_path) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + + before(:each) do + empty_directory_path.mkdir + end + + after(:each) do + empty_directory_path.rmdir + end it "can zap" do Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rm -f --], dir_pathname.join(".DS_Store")), + sudo(%w[/bin/rm -f --], empty_directory_path/".DS_Store"), ) Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rmdir --], dir_pathname), + sudo(%w[/bin/rmdir --], empty_directory_path), ) subject diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb index 706b85f6b2eaab450b87ee555ecab23865952a1b..8416f3f88d7259ef6e603f682a959b14a131351d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb @@ -17,5 +17,5 @@ cask 'with-installable' do 'impermissible/relative/path', '/another/impermissible/../relative/path', ], - rmdir: "#{TEST_FIXTURE_DIR}/cask/empty_directory" + rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb index 252d81994b9a5bc95e55cb9b9e8db6236efb7db0..8ded5b835293785f437cc2f2644bb9abd3bf1e20 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb @@ -7,5 +7,5 @@ cask 'with-uninstall-rmdir' do pkg 'MyFancyPkg/Fancy.pkg' - uninstall rmdir: "#{TEST_FIXTURE_DIR}/cask/empty_directory" + uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb index 02139b3b059c87fcbde13a63381ebc283ba36ace..a67c4ca9aeeb9738280a30176d6e0f1eda8ff6c2 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb @@ -7,5 +7,5 @@ cask 'with-zap-rmdir' do pkg 'MyFancyPkg/Fancy.pkg' - zap rmdir: "#{TEST_FIXTURE_DIR}/cask/empty_directory" + zap rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore b/Library/Homebrew/test/support/fixtures/cask/empty_directory/.gitignore deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000