Remove Sha256Helper
.
This commit is contained in:
parent
bef2c6c9bd
commit
9c623a273b
@ -1,6 +1,5 @@
|
|||||||
describe Hbc::Audit do
|
describe Hbc::Audit do
|
||||||
include AuditMatchers
|
include AuditMatchers
|
||||||
include Sha256Helper
|
|
||||||
|
|
||||||
let(:cask) { instance_double(Hbc::Cask) }
|
let(:cask) { instance_double(Hbc::Cask) }
|
||||||
let(:download) { false }
|
let(:download) { false }
|
||||||
@ -178,7 +177,7 @@ describe Hbc::Audit do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when appcast checkpoint is out of date" do
|
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 { is_expected.to warn_with(mismatch_msg) }
|
||||||
it { should_not warn_with(curl_error_msg) }
|
it { should_not warn_with(curl_error_msg) }
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
describe Hbc::Verify::Checksum do
|
describe Hbc::Verify::Checksum do
|
||||||
include Sha256Helper
|
|
||||||
|
|
||||||
let(:cask) { double("cask") }
|
let(:cask) { double("cask") }
|
||||||
let(:downloaded_path) { double("downloaded_path") }
|
let(:downloaded_path) { double("downloaded_path") }
|
||||||
let(:verification) { described_class.new(cask, downloaded_path) }
|
let(:verification) { described_class.new(cask, downloaded_path) }
|
||||||
@ -35,7 +33,7 @@ describe Hbc::Verify::Checksum do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "sha256 is a valid shasum" do
|
context "sha256 is a valid shasum" do
|
||||||
let(:sha256) { random_sha256 }
|
let(:sha256) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
|
||||||
|
|
||||||
it { is_expected.to be true }
|
it { is_expected.to be true }
|
||||||
end
|
end
|
||||||
@ -44,7 +42,7 @@ describe Hbc::Verify::Checksum do
|
|||||||
describe "#verify" do
|
describe "#verify" do
|
||||||
subject { verification.verify }
|
subject { verification.verify }
|
||||||
|
|
||||||
let(:computed) { random_sha256 }
|
let(:computed) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(verification).to receive(:computed).and_return(computed)
|
allow(verification).to receive(:computed).and_return(computed)
|
||||||
@ -67,7 +65,7 @@ describe Hbc::Verify::Checksum do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "sha256 does not match computed" do
|
context "sha256 does not match computed" do
|
||||||
let(:sha256) { random_sha256 }
|
let(:sha256) { "d3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33fd3adb33f" }
|
||||||
|
|
||||||
it "raises an error" do
|
it "raises an error" do
|
||||||
expect { subject }.to raise_error(Hbc::CaskSha256MismatchError)
|
expect { subject }.to raise_error(Hbc::CaskSha256MismatchError)
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
require"digest"
|
|
||||||
|
|
||||||
module Sha256Helper
|
|
||||||
def random_sha256
|
|
||||||
seed = "--#{rand(10_000)}--#{Time.now}--"
|
|
||||||
Digest::SHA2.hexdigest(seed)
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user