Type:
Module

Active Model Lint Tests

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.

Note an object is not required to implement all APIs in order to work with Action Pack. This module only intends to provide guidance in case you want all features out of the box.

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.

test_persisted?
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_persisted?() Instance Public methods Responds to persisted?

2025-01-10 15:47:30
test_errors_aref
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_errors_aref() Instance Public methods Errors Testing

2025-01-10 15:47:30
test_to_param
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_to_param() Instance Public methods Responds to to_param

2025-01-10 15:47:30
test_to_key
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_to_key() Instance Public methods Responds to to_key

2025-01-10 15:47:30
test_to_partial_path
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_to_partial_path() Instance Public methods Responds to to_partial_path

2025-01-10 15:47:30
test_model_naming
  • References/Ruby on Rails/Rails/Classes/ActiveModel/ActiveModel::Lint/ActiveModel::Lint::Tests

test_model_naming() Instance Public methods Naming Model

2025-01-10 15:47:30