Sha256: 4934ce893cf3f728a5e91003e560655019510c8f72f5989d070db13f03d503e7

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

require 'spec_helper'

good_path = 'README.md'
bad_path = 'BAD_FILE.md'

describe Clamby do
  it "should find files." do
    expect(Clamby.file_exists?(good_path)).to be true
  end

  it "should find clamscan" do
    expect(Clamby.scanner_exists?).to be true
  end

  it "should not find files." do
    Clamby.configure({:error_file_missing => true})
    expect{Clamby.file_exists?(bad_path)}.to raise_exception(Exceptions::FileNotFound)
    Clamby.configure({:error_file_missing => false})
    expect(Clamby.file_exists?(bad_path)).to be false
  end

  it "should scan file as safe" do
    expect(Clamby.scan(good_path)).to be true
  end

  it "should scan file as dangerous" do
    `wget http://www.eicar.org/download/eicar.com`
    Clamby.configure({:error_file_virus => true})
    expect{Clamby.scan('eicar.com')}.to raise_exception(Exceptions::VirusDetected)
    Clamby.configure({:error_file_virus => false})
    expect(Clamby.scan('eicar.com')).to be false
    File.delete('eicar.com')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clamby-1.0.4 spec/clamby_spec.rb