Sha256: 2ea537c31c9c4d4c94c81e0532ea4b04c10b41fea231d28606335cf3e151d19b
Contents?: true
Size: 1.19 KB
Versions: 13
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe CharacterizeJob do # I'm not entirely certain where I want to put this. Given that it is # leaning on an actor, I'd like to put it there. But actors are going to # push to a queue, so it is the worker that should choke. describe '#run' do let(:user) { FactoryGirl.create(:user) } let(:image_file) { Rack::Test::UploadedFile.new( File.expand_path('../../fixtures/files/image.png', __FILE__), 'image/png', false ) } let(:generic_file) { FactoryGirl.create_generic_file(:generic_work, user, image_file) } subject { CharacterizeJob.new(generic_file.pid) } it 'deletes the generic file when I upload a virus' do EnvironmentOverride.with_anti_virus_scanner(false) do expect { subject.run }.to raise_error(AntiVirusScanner::VirusDetected) end end it 'should create a thumbnail' do GenericFile.any_instance.stub(:image?).and_return(true) GenericFile.any_instance.stub(:mime_type).and_return('image/png') expect { subject.run }.to change { generic_file.reload.datastreams['thumbnail'].mimeType }.from(nil).to('image/png') end end end
Version data entries
13 entries across 13 versions & 1 rubygems