diff --git a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb index 872a154ae5..c68f241eea 100644 --- a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb +++ b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb @@ -185,15 +185,15 @@ shared_examples "#uninstall_phase or #zap_phase" do it "is supported" do allow(subject).to receive(:system_command!) .with("/usr/sbin/kextstat", args: ["-l", "-b", kext_id], sudo: true, sudo_as_root: true) - .and_return(instance_double("SystemCommand::Result", stdout: "loaded")) + .and_return(instance_double(SystemCommand::Result, stdout: "loaded")) expect(subject).to receive(:system_command!) .with("/sbin/kextunload", args: ["-b", kext_id], sudo: true, sudo_as_root: true) - .and_return(instance_double("SystemCommand::Result")) + .and_return(instance_double(SystemCommand::Result)) expect(subject).to receive(:system_command!) .with("/usr/sbin/kextfind", args: ["-b", kext_id], sudo: true, sudo_as_root: true) - .and_return(instance_double("SystemCommand::Result", stdout: "/Library/Extensions/FancyPackage.kext\n")) + .and_return(instance_double(SystemCommand::Result, stdout: "/Library/Extensions/FancyPackage.kext\n")) expect(subject).to receive(:system_command!) .with("/bin/rm", args: ["-rf", "/Library/Extensions/FancyPackage.kext"], sudo: true, sudo_as_root: true) @@ -220,7 +220,7 @@ shared_examples "#uninstall_phase or #zap_phase" do expect(subject).to receive(:running?).with(bundle_id).ordered.and_return(true) expect(subject).to receive(:quit).with(bundle_id) - .and_return(instance_double("SystemCommand::Result", success?: true)) + .and_return(instance_double(SystemCommand::Result, success?: true)) expect(subject).to receive(:running?).with(bundle_id).ordered.and_return(false) expect do @@ -247,7 +247,7 @@ shared_examples "#uninstall_phase or #zap_phase" do allow(subject).to receive(:running?).with(bundle_id).and_return(true) allow(subject).to receive(:quit).with(bundle_id) - .and_return(instance_double("SystemCommand::Result", success?: false)) + .and_return(instance_double(SystemCommand::Result, success?: false)) time = Benchmark.measure do expect do @@ -369,7 +369,7 @@ shared_examples "#uninstall_phase or #zap_phase" do "osascript", args: ["-e", 'tell application "System Events" to delete every login item whose name is "Fancy"'], ) - .and_return(instance_double("SystemCommand::Result", success?: true)) + .and_return(instance_double(SystemCommand::Result, success?: true)) subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) end diff --git a/Library/Homebrew/test/cask/dsl/shared_examples/staged.rb b/Library/Homebrew/test/cask/dsl/shared_examples/staged.rb index 07fe99b05d..0c0d38eb6c 100644 --- a/Library/Homebrew/test/cask/dsl/shared_examples/staged.rb +++ b/Library/Homebrew/test/cask/dsl/shared_examples/staged.rb @@ -7,12 +7,8 @@ shared_examples Cask::Staged do let(:non_existent_path) { Pathname("/path/to/file/that/does/not/exist") } before do - allow(existing_path).to receive(:exist?).and_return(true) - allow(existing_path).to receive(:expand_path) - .and_return(existing_path) - allow(non_existent_path).to receive(:exist?).and_return(false) - allow(non_existent_path).to receive(:expand_path) - .and_return(non_existent_path) + allow(existing_path).to receive_messages(exist?: true, expand_path: existing_path) + allow(non_existent_path).to receive_messages(exist?: false, expand_path: non_existent_path) end it "can run system commands with list-form arguments" do