diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index 6efde45942..eefdc2521e 100644 --- a/Library/Homebrew/test/cask/artifact/app_spec.rb +++ b/Library/Homebrew/test/cask/artifact/app_spec.rb @@ -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