Module: Meicar

Defined in:
lib/meicar.rb

Constant Summary collapse

TEST_STRING =
"X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"

Class Method Summary collapse

Class Method Details

.with_fake_virus(&block) ⇒ Object

Instantiates an “infected” file in a temp folder, passes its path, and then deletes it afterwards.



8
9
10
11
12
13
14
# File 'lib/meicar.rb', line 8

def self.with_fake_virus(&block)
  Tempfile.open("eicar_test_virus") do |f|
    f.write(TEST_STRING)
    f.close
    block.call(f.path)
  end
end