A platform for community discussion. Free, open, simple.
DEV: Add spec for removing and re-adding hotlinked images
David Taylordf39e372d707
diff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 27235a1903f..ab947c5dc9b 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -74,6 +74,25 @@ describe Jobs::PullHotlinkedImages doexpect(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("")++ # 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("")+ end+it 'replaces encoded image urls' dopost = Fabricate(:post, raw: "<img src='#{encoded_image_url}'>")expect do