Merge pull request #3968 from amancevice/checksum-eq-defense

Defensive check for Checksum == nil
This commit is contained in:
Mike McQuaid 2018-03-24 16:20:29 +00:00 committed by GitHub
commit 824b814578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -13,6 +13,6 @@ class Checksum
delegate [:empty?, :to_s] => :@hexdigest
def ==(other)
hash_type == other.hash_type && hexdigest == other.hexdigest
hash_type == other&.hash_type && hexdigest == other.hexdigest
end
end

View File

@ -15,5 +15,6 @@ describe Checksum do
it { is_expected.to eq(other) }
it { is_expected.not_to eq(other_reversed) }
it { is_expected.not_to eq(other_sha1) }
it { is_expected.not_to eq(nil) }
end
end