You can test whether an object is compliant with the Active Model API by including ActiveModel::Lint::Tests in
your TestCase. It will include
tests that tell you whether your object is fully compliant, or if not,
which aspects of the API are not implemented.
These tests do not attempt to determine the semantic correctness of the
returned values. For instance, you could implement valid? to always return
true, and the tests would pass. It is up to you to ensure that the values
are semantically meaningful.
Objects you pass in are expected to return a compliant object from a call
to to_model. It is perfectly fine for to_model to return self.
Show files where this module is defined (32 files)
activemodel/lib/active_model/validations/validates.rb
activemodel/lib/active_model/validations/with.rb
activemodel/lib/active_model/validations/acceptance.rb
activemodel/lib/active_model/validations/callbacks.rb
activemodel/lib/active_model/validations/confirmation.rb
activemodel/lib/active_model/validations/exclusion.rb
activemodel/lib/active_model/validations/format.rb
activemodel/lib/active_model/validations/inclusion.rb
activemodel/lib/active_model/validations/length.rb
activemodel/lib/active_model/validations/numericality.rb
activemodel/lib/active_model/validations/presence.rb
activemodel/lib/active_model/serializers/json.rb
activemodel/lib/active_model/serializers/xml.rb
activemodel/lib/active_model/test_case.rb
activemodel/lib/active_model/callbacks.rb
activemodel/lib/active_model/conversion.rb
activemodel/lib/active_model/dirty.rb
activemodel/lib/active_model/lint.rb
activemodel/lib/active_model/mass_assignment_security.rb
activemodel/lib/active_model/mass_assignment_security/permission_set.rb
activemodel/lib/active_model/mass_assignment_security/sanitizer.rb
activemodel/lib/active_model/validator.rb
activemodel/lib/active_model/attribute_methods.rb
activemodel/lib/active_model/deprecated_error_methods.rb
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/naming.rb
activemodel/lib/active_model/observing.rb
activemodel/lib/active_model/serialization.rb
activemodel/lib/active_model/translation.rb
activemodel/lib/active_model/validations.rb
activemodel/lib/active_model/version.rb
activemodel/lib/active_model.rb