Add coverage on new behavior of FileChecksum

This commit is contained in:
Chris Roberts 2019-10-04 17:30:07 -07:00
parent 0bce1e6307
commit 04a1bb58f3
1 changed files with 12 additions and 0 deletions

View File

@ -20,4 +20,16 @@ describe FileChecksum do
instance = described_class.new(file, Digest::SHA1)
expect(instance.checksum).to eq("264b207c7913e461c43d0f63d2512f4017af4755")
end
it "should support initialize with class or string" do
file = environment.workdir.join("file")
file.open("w+") { |f| f.write("HELLO!") }
%w(md5 sha1 sha256 sha384 sha512).each do |type|
klass = Digest.const_get(type.upcase)
t_i = described_class.new(file, type)
k_i = described_class.new(file, klass)
expect(t_i.checksum).to eq(k_i.checksum)
end
end
end