mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -06:00
DEV: Add spec for removing and re-adding hotlinked images
Before the recent refactor, this would fail. https://meta.discourse.org/t/154184
This commit is contained in:
parent
2193d02433
commit
df39e372d7
@ -74,6 +74,25 @@ describe Jobs::PullHotlinkedImages do
|
||||
expect(post.post_uploads.count).to eq(0)
|
||||
end
|
||||
|
||||
it 'replaces images again after edit' do
|
||||
post = Fabricate(:post, raw: "<img src='#{image_url}'>")
|
||||
|
||||
expect do
|
||||
post.rebake!
|
||||
end.to change { Upload.count }.by(1)
|
||||
|
||||
expect(post.reload.raw).to eq("![](#{Upload.last.short_url})")
|
||||
|
||||
# Post raw is updated back to the old value (e.g. by wordpress integration)
|
||||
post.update(raw: "<img src='#{image_url}'>")
|
||||
|
||||
expect do
|
||||
post.rebake!
|
||||
end.to change { Upload.count }.by(0) # We alread have the upload
|
||||
|
||||
expect(post.reload.raw).to eq("![](#{Upload.last.short_url})")
|
||||
end
|
||||
|
||||
it 'replaces encoded image urls' do
|
||||
post = Fabricate(:post, raw: "<img src='#{encoded_image_url}'>")
|
||||
expect do
|
||||
|
Loading…
Reference in New Issue
Block a user