2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-16 03:15:46 +01:00
|
|
|
require "extend/string"
|
|
|
|
|
|
|
|
describe StringInreplaceExtension do
|
|
|
|
subject { string.extend(described_class) }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
2019-04-20 14:07:29 +09:00
|
|
|
let(:string) { +"foobar" }
|
2017-02-16 03:15:46 +01:00
|
|
|
|
|
|
|
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
|