diff --git a/Library/Homebrew/test/utils/inreplace_spec.rb b/Library/Homebrew/test/utils/inreplace_spec.rb index ba1e825a35..a6b0a044b5 100644 --- a/Library/Homebrew/test/utils/inreplace_spec.rb +++ b/Library/Homebrew/test/utils/inreplace_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Utils::Inreplace do it "raises error if there is nothing to replace" do expect do described_class.inreplace file.path, "d", "f" - end.not_to raise_error(Utils::Inreplace::Error) + end.to raise_error(Utils::Inreplace::Error) end it "raises error if there is nothing to replace in block form" do diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index 504fa6748c..a7e3e9bddf 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -50,7 +50,7 @@ module Utils block: T.nilable(T.proc.params(s: StringInreplaceExtension).void), ).void } - def self.inreplace(paths, before = nil, after = nil, audit_result: false, &block) + def self.inreplace(paths, before = nil, after = nil, audit_result: true, &block) paths = Array(paths) after &&= after.to_s before = before.to_s if before.is_a?(Pathname)