brew/Library/Homebrew/test/string_spec.rb
vidusheeamoli fd382d2ecd srb: set utils/inreplace.rb to true and refactor
- 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.
2020-07-26 12:43:31 +05:30

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