Exception: IdentityAssay

Inherits:
EqualityAssay show all
Defined in:
lib/assay/identity_assay.rb

Overview

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.

Constant Summary

Constants inherited from Assertion

Assertion::SIZE_LIMIT

Constants included from Assay::Assertable

Assay::Assertable::SIZE_LIMIT

Class Method Summary collapse

Methods inherited from EqualAssay

assert_message

Methods inherited from Assertion

by_name, by_operator, inherited, register, subclasses

Methods included from Assay::Assertable

#[], #assert!, #assert_message, #assertive_name, #assertor, #fail?, #operator, #pass?, #refute!, #refute_message

Class Method Details

.pass?(subject, criterion) ⇒ Boolean

Check assertion using ‘object_id == object_id`.

Returns:

  • (Boolean)


16
17
18
# File 'lib/assay/identity_assay.rb', line 16

def self.pass?(subject, criterion)
  subject.identical?(criterion)  #subject.object_id == criterion.object_id
end