diff --git a/app/models/post.rb b/app/models/post.rb
index 98d7a821db8..f8228e5655f 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -113,7 +113,7 @@ class Post < ActiveRecord::Base
scope :have_uploads, -> {
where(
- "(posts.cooked LIKE '%").id
+ ids << Fabricate(:post, cooked: "A post with optimized image
").id
+ Fabricate(:post)
+ ids << Fabricate(:post, cooked: "A post with upload
").id
+ ids << Fabricate(:post, cooked: "A post with upload link ").id
+ ids << Fabricate(:post, cooked: "A post with optimized image
").id
+ Fabricate(:post, cooked: "A post with external link ")
+ expect(Post.have_uploads.order(:id).pluck(:id)).to eq(ids)
+ end
+ end
+
end