Commit 132f369f authored by Micaël Bergeron's avatar Micaël Bergeron

personal snippets will now comply with `background_upload`

parent 67ee64f4
...@@ -10,7 +10,11 @@ class FileMover ...@@ -10,7 +10,11 @@ class FileMover
def execute def execute
move move
uploader.record_upload if update_markdown
if update_markdown
uploader.record_upload
uploader.schedule_background_upload
end
end end
private private
......
...@@ -55,6 +55,7 @@ module ObjectStorage ...@@ -55,6 +55,7 @@ module ObjectStorage
def schedule_background_upload(*args) def schedule_background_upload(*args)
return unless schedule_background_upload? return unless schedule_background_upload?
return unless upload
ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name, ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name,
upload.class.to_s, upload.class.to_s,
......
...@@ -36,6 +36,12 @@ describe FileMover do ...@@ -36,6 +36,12 @@ describe FileMover do
it 'creates a new update record' do it 'creates a new update record' do
expect { subject }.to change { Upload.count }.by(1) expect { subject }.to change { Upload.count }.by(1)
end end
it 'schedules a background migration' do
expect_any_instance_of(PersonalFileUploader).to receive(:schedule_background_upload).once
subject
end
end end
context 'when update_markdown fails' do context 'when update_markdown fails' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment