Skip to content
Snippets Groups Projects
Commit 9c623a27 authored by Markus Reiter's avatar Markus Reiter
Browse files

Remove `Sha256Helper`.

parent bef2c6c9
No related branches found
No related tags found
No related merge requests found
describe Hbc::Audit do
include AuditMatchers
include Sha256Helper
let(:cask) { instance_double(Hbc::Cask) }
let(:download) { false }
......@@ -178,7 +177,7 @@ describe Hbc::Audit do
end
context "when appcast checkpoint is out of date" do
let(:actual_checkpoint) { random_sha256 }
let(:actual_checkpoint) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
it { is_expected.to warn_with(mismatch_msg) }
it { should_not warn_with(curl_error_msg) }
end
......
describe Hbc::Verify::Checksum do
include Sha256Helper
let(:cask) { double("cask") }
let(:downloaded_path) { double("downloaded_path") }
let(:verification) { described_class.new(cask, downloaded_path) }
......@@ -35,7 +33,7 @@ describe Hbc::Verify::Checksum do
end
context "sha256 is a valid shasum" do
let(:sha256) { random_sha256 }
let(:sha256) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
it { is_expected.to be true }
end
......@@ -44,7 +42,7 @@ describe Hbc::Verify::Checksum do
describe "#verify" do
subject { verification.verify }
let(:computed) { random_sha256 }
let(:computed) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
before do
allow(verification).to receive(:computed).and_return(computed)
......@@ -67,7 +65,7 @@ describe Hbc::Verify::Checksum do
end
context "sha256 does not match computed" do
let(:sha256) { random_sha256 }
let(:sha256) { "d3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33f" }
it "raises an error" do
expect { subject }.to raise_error(Hbc::CaskSha256MismatchError)
......
require"digest"
module Sha256Helper
def random_sha256
seed = "--#{rand(10_000)}--#{Time.now}--"
Digest::SHA2.hexdigest(seed)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment