mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

- Sorbet gives preference to class methods over methods defined in included modules, hence Sorbet was unavailable to resolve the definition of the gsub! method. - The gsub! method in StringInreplaceExtension conflicts with the definition in String. - This PR refactors the call to the gsub! method so that a custom object is exposed instead of a string.
17 lines
397 B
Ruby
17 lines
397 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "extend/string"
|
|
|
|
describe StringInreplaceExtension do
|
|
subject { described_class.new(string) }
|
|
|
|
let(:string) { +"foobar" }
|
|
|
|
describe "#sub!" do
|
|
it "adds an error to #errors when no replacement was made" do
|
|
subject.sub! "not here", "test"
|
|
expect(subject.errors).to eq(['expected replacement of "not here" with "test"'])
|
|
end
|
|
end
|
|
end
|