mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 07:52:19 +08:00
DEV: Add specs for cleaning up uploads in non pending reviable posts.
Follow up to f7ebfb1acc
This commit is contained in:
parent
f65c8a7ba1
commit
afbf852e0e
|
@ -237,10 +237,17 @@ describe Jobs::CleanUpUploads do
|
|||
it "does not delete uploads in a queued post" do
|
||||
upload = fabricate_upload
|
||||
upload2 = fabricate_upload
|
||||
upload3 = fabricate_upload
|
||||
|
||||
ReviewableQueuedPost.create(
|
||||
created_by: Fabricate(:user),
|
||||
payload: { raw: "#{upload.sha1}\n#{upload2.short_url}" },
|
||||
Fabricate(:reviewable_queued_post_topic, payload: {
|
||||
raw: "#{upload.sha1}\n#{upload2.short_url}"
|
||||
})
|
||||
|
||||
Fabricate(:reviewable_queued_post_topic,
|
||||
payload: {
|
||||
raw: "#{upload3.sha1}"
|
||||
},
|
||||
status: Reviewable.statuses[:rejected]
|
||||
)
|
||||
|
||||
Jobs::CleanUpUploads.new.execute(nil)
|
||||
|
@ -248,6 +255,7 @@ describe Jobs::CleanUpUploads do
|
|||
expect(Upload.exists?(id: @upload.id)).to eq(false)
|
||||
expect(Upload.exists?(id: upload.id)).to eq(true)
|
||||
expect(Upload.exists?(id: upload2.id)).to eq(true)
|
||||
expect(Upload.exists?(id: upload3.id)).to eq(false)
|
||||
end
|
||||
|
||||
it "does not delete uploads in a draft" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user