personal snippets will now comply with `background_upload`

This commit is contained in:
Micaël Bergeron 2018-03-16 14:34:55 -04:00
parent 2dbd31c1bb
commit c0047fc473
3 changed files with 12 additions and 1 deletions

View File

@ -10,7 +10,11 @@ class FileMover
def execute
move
uploader.record_upload if update_markdown
if update_markdown
uploader.record_upload
uploader.schedule_background_upload
end
end
private

View File

@ -52,6 +52,7 @@ module ObjectStorage
def schedule_background_upload(*args)
return unless schedule_background_upload?
return unless upload
ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name,
upload.class.to_s,

View File

@ -36,6 +36,12 @@ describe FileMover do
it 'creates a new update record' do
expect { subject }.to change { Upload.count }.by(1)
end
it 'schedules a background migration' do
expect_any_instance_of(PersonalFileUploader).to receive(:schedule_background_upload).once
subject
end
end
context 'when update_markdown fails' do