added a job to clean up orphan uploads

This commit is contained in:
Régis Hanol
2013-10-14 14:27:41 +02:00
parent cf08d2c751
commit 4536b5fe04
7 changed files with 86 additions and 19 deletions

View File

@ -10,6 +10,7 @@ describe CookedPostProcessor do
let(:post_process) { sequence("post_process") }
it "post process in sequence" do
cpp.expects(:clean_up_reverse_index).in_sequence(post_process)
cpp.expects(:post_process_attachments).in_sequence(post_process)
cpp.expects(:post_process_images).in_sequence(post_process)
cpp.expects(:post_process_oneboxes).in_sequence(post_process)
@ -18,6 +19,18 @@ describe CookedPostProcessor do
end
context "clean_up_reverse_index" do
let(:post) { build(:post) }
let(:cpp) { CookedPostProcessor.new(post) }
it "cleans the reverse index up for the current post" do
PostUpload.expects(:delete_all).with(post_id: post.id)
cpp.clean_up_reverse_index
end
end
context "post_process_attachments" do
context "with attachment" do