diff --git a/Library/Homebrew/test/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index b5d8766554..3f10c23343 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -284,6 +284,7 @@ describe Caveats do let(:caveats) { described_class.new(f).caveats } it "adds the correct amount of new lines to the output" do + expect(Utils::Service).to receive(:launchctl?).at_least(:once).and_return(true) expect(caveats).to include("something else") expect(caveats).to include("keg-only") expect(caveats).to include("if you don't want/need a background service") diff --git a/Library/Homebrew/test/unpack_strategy_spec.rb b/Library/Homebrew/test/unpack_strategy_spec.rb index 4aff39e054..9082fdc04b 100644 --- a/Library/Homebrew/test/unpack_strategy_spec.rb +++ b/Library/Homebrew/test/unpack_strategy_spec.rb @@ -65,7 +65,8 @@ describe UnpackStrategy do it "does not make other files writable" do strategy.extract_nestedly(to: unpack_dir) - expect(unpack_dir/executable).not_to be_writable + # We don't check `writable?` here as that's always true as root. + expect((unpack_dir/executable).stat.mode & 0222).to be_zero end end end