mirror of
https://github.com/gosticks/brew.git
synced 2026-10-05 23:16:55 +00:00
Convert Checksum test to spec.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
require "checksum"
|
||||
|
||||
describe Checksum do
|
||||
describe "#empty?" do
|
||||
subject { described_class.new(:sha256, "") }
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
describe "#==" do
|
||||
subject { described_class.new(:sha256, TEST_SHA256) }
|
||||
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) }
|
||||
end
|
||||
end
|
||||
@@ -1,22 +0,0 @@
|
||||
require "testing_env"
|
||||
require "checksum"
|
||||
|
||||
class ChecksumTests < Homebrew::TestCase
|
||||
def test_empty?
|
||||
assert_empty Checksum.new(:sha256, "")
|
||||
end
|
||||
|
||||
def test_equality
|
||||
a = Checksum.new(:sha256, TEST_SHA256)
|
||||
b = Checksum.new(:sha256, TEST_SHA256)
|
||||
assert_equal a, b
|
||||
|
||||
a = Checksum.new(:sha256, TEST_SHA256)
|
||||
b = Checksum.new(:sha256, TEST_SHA256.reverse)
|
||||
refute_equal a, b
|
||||
|
||||
a = Checksum.new(:sha1, TEST_SHA1)
|
||||
b = Checksum.new(:sha256, TEST_SHA256)
|
||||
refute_equal a, b
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user