Merge pull request #3968 from amancevice/checksum-eq-defense
Defensive check for Checksum == nil
This commit is contained in:
commit
824b814578
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user