Sha256: b037cec091eb23f47723d9837130dec188cac90aa24c9dbbc1f0cec086ad5afa
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe Hydra::Works::VirusCheck do context "with ClamAV" do subject { FileWithVirusCheck.new } let(:file) { Hydra::PCDM::File.new { |f| f.content = File.new(File.join(fixture_path, 'sample-file.pdf')) } } before do class FileWithVirusCheck < ActiveFedora::Base include Hydra::Works::FileSetBehavior include Hydra::Works::VirusCheck end allow(subject).to receive(:original_file) { file } end after do Object.send(:remove_const, :FileWithVirusCheck) end context 'with an infected file' do before do expect(Hydra::Works::VirusCheckerService).to receive(:file_has_virus?).and_return(true) end it 'fails to save' do expect(subject.save).to eq false end it 'fails to validate' do expect(subject.validate).to eq false end end context 'with a clean file' do before do end it 'does not detect viruses' do expect(Hydra::Works::VirusCheckerService).to receive(:file_has_virus?).and_return(false) subject.detect_viruses end end end end
Version data entries
4 entries across 4 versions & 1 rubygems