Revert "Swtich to regexp for DbHelper.remap."

Regexp is so much slower.

This reverts commit c3f89e3cd73ef4a4d42972bf19a53576d2228399.
This commit is contained in:
Guo Xiang Tan
2018-11-08 14:20:09 +08:00
parent c3f89e3cd7
commit 57f92ac808
2 changed files with 6 additions and 28 deletions

View File

@ -40,29 +40,5 @@ RSpec.describe DbHelper do
expect(post.reload.cooked).to eq('test')
end
it 'accepts a POSIX regular expression' do
url = "https://some.complicated.url/that/I/can/come/up.with"
post = Fabricate(:post,
cooked: "something something#{url}something something"
)
url2 = "https://some.other.complicated/url/I/can/come/up.with"
post2 = Fabricate(:post,
cooked: "something #{url2} something something"
)
DbHelper.remap("(#{url}|#{url2})", "DISCOURSE!")
expect(post.reload.cooked).to eq(
'something somethingDISCOURSE!something something'
)
expect(post2.reload.cooked).to eq(
"something DISCOURSE! something something"
)
end
end
end