Add test/archive_spec.rb

This commit is contained in:
Shaun Jackman 2021-02-22 18:07:39 -08:00
parent 3d715ca3f0
commit 0f2c47dbe3
No known key found for this signature in database
GPG Key ID: D4ED5223F4E57996

View File

@ -0,0 +1,20 @@
# typed: false
# frozen_string_literal: true
require "archive"
describe Archive, :needs_network do
subject(:archive) { described_class.new(item: "homebrew") }
describe "::remote_checksum" do
it "detects a published file" do
hash = archive.remote_md5(directory: ".", remote_file: "cmake-3.1.2.yosemite.bottle.tar.gz")
expect(hash).to eq("c6e525d472124670b0b635800488f438")
end
it "fails on a non-existent file" do
hash = archive.remote_md5(directory: "bottles", remote_file: "my-fake-bottle-1.0.snow_hyena.tar.gz")
expect(hash).to be nil
end
end
end