Method: ActiveModel::Serializer::Lint::Tests#test_serializable_hash
- Defined in:
- lib/active_model/serializer/lint.rb
#test_serializable_hash ⇒ Object
Passes if the object responds to serializable_hash and if it takes zero or one arguments. Fails otherwise.
serializable_hash returns a hash representation of a object’s attributes. Typically, it is implemented by including ActiveModel::Serialization.
28 29 30 31 32 |
# File 'lib/active_model/serializer/lint.rb', line 28 def test_serializable_hash assert_respond_to resource, :serializable_hash, 'The resource should respond to serializable_hash' resource.serializable_hash resource.serializable_hash(nil) end |