More test cleanup.

This commit is contained in:
JBYoshi 2023-05-12 09:52:57 -05:00
parent 0ddeba6de6
commit 4a3b8923f2
No known key found for this signature in database
GPG Key ID: AE4430116622D05D

View File

@ -338,23 +338,24 @@ describe Cask::Artifact::App, :cask do
it "properly handles non-writable directories" do
install_phase
contents_path = target_path.join("Contents")
source_contents_path = source_path.join("Contents")
target_contents_path = target_path.join("Contents")
expect(app.target).to receive(:writable?).at_least(:once).and_return false
allow(command).to receive(:run!).with(any_args).and_call_original
expect(command).to receive(:run!)
.with("/bin/cp", args: ["-pR", source_path.join("Contents"), target_path],
.with("/bin/cp", args: ["-pR", source_contents_path, target_path],
sudo: true)
.and_call_original
allow(command).to receive(:run!).with(any_args).and_call_original
expect(FileUtils).not_to receive(:move).with(source_path.join("Contents"), contents_path)
expect(FileUtils).not_to receive(:move).with(source_contents_path, target_contents_path)
app.uninstall_phase(command: command, force: force, successor: cask)
expect(contents_path).not_to exist
expect(target_contents_path).not_to exist
expect(target_path).to exist
expect(source_path.join("Contents")).to exist
expect(source_contents_path).to exist
app.install_phase(command: command, adopt: adopt, force: force, predecessor: cask)
expect(contents_path).to exist
expect(target_contents_path).to exist
end
end
end