Remove Sha256Helper.

This commit is contained in:
Markus Reiter 2017-02-08 07:24:41 +01:00
parent bef2c6c9bd
commit 9c623a273b
3 changed files with 4 additions and 15 deletions

View File

@ -1,6 +1,5 @@
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

View File

@ -1,6 +1,4 @@
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)

View File

@ -1,8 +0,0 @@
require"digest"
module Sha256Helper
def random_sha256
seed = "--#{rand(10_000)}--#{Time.now}--"
Digest::SHA2.hexdigest(seed)
end
end