2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-14 20:01:45 +01:00
|
|
|
require "checksum"
|
|
|
|
|
|
|
|
describe Checksum do
|
|
|
|
describe "#empty?" do
|
|
|
|
subject { described_class.new(:sha256, "") }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
2017-02-14 20:01:45 +01:00
|
|
|
it { is_expected.to be_empty }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#==" do
|
|
|
|
subject { described_class.new(:sha256, TEST_SHA256) }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
2017-02-14 20:01:45 +01:00
|
|
|
let(:other) { described_class.new(:sha256, TEST_SHA256) }
|
|
|
|
let(:other_reversed) { described_class.new(:sha256, TEST_SHA256.reverse) }
|
|
|
|
let(:other_sha1) { described_class.new(:sha1, TEST_SHA1) }
|
|
|
|
|
|
|
|
it { is_expected.to eq(other) }
|
|
|
|
it { is_expected.not_to eq(other_reversed) }
|
|
|
|
it { is_expected.not_to eq(other_sha1) }
|
2018-03-24 09:04:51 -04:00
|
|
|
it { is_expected.not_to eq(nil) }
|
2017-02-14 20:01:45 +01:00
|
|
|
end
|
|
|
|
end
|