diff options
| author | Markus Reiter | 2017-02-15 15:48:20 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-15 15:48:20 +0100 |
| commit | 3babab25bb0de001e3494ca86ce14970622f45fe (patch) | |
| tree | 553b263db2eeeb1213ef127b9007844bdd550185 /Library/Homebrew/test | |
| parent | 716b40806864a3c5cacb034936ff786b21846bbc (diff) | |
| parent | 3bc0c6bd1a74fb5a77fdaca45543eca752eee64f (diff) | |
| download | brew-3babab25bb0de001e3494ca86ce14970622f45fe.tar.bz2 | |
Merge pull request #2014 from reitermarkus/spec-checksum
Convert Checksum test to spec.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/checksum_spec.rb | 19 | ||||
| -rw-r--r-- | Library/Homebrew/test/checksum_test.rb | 22 |
2 files changed, 19 insertions, 22 deletions
diff --git a/Library/Homebrew/test/checksum_spec.rb b/Library/Homebrew/test/checksum_spec.rb new file mode 100644 index 000000000..acab348b7 --- /dev/null +++ b/Library/Homebrew/test/checksum_spec.rb @@ -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 diff --git a/Library/Homebrew/test/checksum_test.rb b/Library/Homebrew/test/checksum_test.rb deleted file mode 100644 index 5505f6824..000000000 --- a/Library/Homebrew/test/checksum_test.rb +++ /dev/null @@ -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 |
