Sha256: 2ac01b225541328ceae9870f7e89a3d9930da7ff7eb8059f6e44e997828a759f
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require_relative 'equality_assay' # Check that two objects are one and the same object. # # NOTE: Ruby defines #equal? to mean #identical? but I believe # this to be a misnomer, at the very least. So we use the term # `identical` instead. # class IdentityAssay < EqualityAssay register :identical # # Check assertion using `object_id == object_id`. # def self.pass?(subject, criterion) subject.identical?(criterion) #subject.object_id == criterion.object_id end # # # # # # # def assert_message(subject) # a = subject.inspect # b = criteria.first.inspect # # if a.size > SIZE_LIMIT or b.size > SIZE_LIMIT # "a.identical?object_id == b.object.id\na) #{criterion}\nb) #{actual}" # else # "#{criterion}.object_id == #{actual}.object.id" # end # end # # # # # # # # def refute_message(subject) # actual = subject.inspect # criterion = criteria.first.inspect # # if actual.size > SIZE_LIMIT or criterion.size > SIZE_LIMIT # "a.object_id != b.object.id\na) #{criterion}\nb) #{actual}" # else # "#{criterion}.object_id != #{actual}.object.id" # end # end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
assay-0.4.1 | lib/assay/identity_assay.rb |
assay-0.4.0 | lib/assay/identity_assay.rb |