diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-02-22 22:25:06 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-03-06 22:41:09 +0300 |
commit | 4c622b71fd284058deee483bf0009f8179b792bc (patch) | |
tree | 306cc2ffb5eec2d4fc972b33d14be2baf3959718 /spec/workers/upload_checksum_worker_spec.rb | |
parent | 2a2b24d5a7687abf7e7517eb011ba427852d6df0 (diff) |
Add Upload model and UploadChecksumWorker worker
Diffstat (limited to 'spec/workers/upload_checksum_worker_spec.rb')
-rw-r--r-- | spec/workers/upload_checksum_worker_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/workers/upload_checksum_worker_spec.rb b/spec/workers/upload_checksum_worker_spec.rb new file mode 100644 index 00000000000..911360da66c --- /dev/null +++ b/spec/workers/upload_checksum_worker_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +describe UploadChecksumWorker do + describe '#perform' do + it 'rescues ActiveRecord::RecordNotFound' do + expect { described_class.new.perform(999_999) }.not_to raise_error + end + + it 'calls calculate_checksum_without_delay and save!' do + upload = spy + expect(Upload).to receive(:find).with(999_999).and_return(upload) + + described_class.new.perform(999_999) + + expect(upload).to have_received(:calculate_checksum) + expect(upload).to have_received(:save!) + end + end +end |