1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add naming to AMo::Lint

This commit is contained in:
José Valim 2009-12-31 14:19:30 +01:00
parent 7cc0a4cfa1
commit 653fa4c10c
2 changed files with 16 additions and 0 deletions

View file

@ -41,6 +41,20 @@ module ActiveModel
assert_boolean model.destroyed?, "destroyed?"
end
# naming
# ------
#
# Model.model_name must returns a string with some convenience methods as
# :human and :partial_path. Check ActiveModel::Naming for more information.
#
def test_model_naming
assert model.class.respond_to?(:model_name), "The model should respond to model_name"
model_name = model.class.model_name
assert_kind_of String, model_name
assert_kind_of String, model_name.human
assert_kind_of String, model_name.partial_path
end
# errors
# ------
#

View file

@ -4,6 +4,8 @@ class LintTest < ActiveModel::TestCase
include ActiveModel::Lint::Tests
class CompliantModel
extend ActiveModel::Naming
def to_model
self
end