Skip to content

Commit

Permalink
Add naming to AMo::Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 2, 2010
1 parent 7cc0a4c commit 653fa4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions activemodel/lib/active_model/lint.rb
Expand Up @@ -41,6 +41,20 @@ def test_destroyed?
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
# ------
#
Expand Down
2 changes: 2 additions & 0 deletions activemodel/test/cases/lint_test.rb
Expand Up @@ -4,6 +4,8 @@ class LintTest < ActiveModel::TestCase
include ActiveModel::Lint::Tests

class CompliantModel
extend ActiveModel::Naming

def to_model
self
end
Expand Down

0 comments on commit 653fa4c

Please sign in to comment.