提交 cf55e4e3 编写于 作者: M Mikel Lindsaar

Added documentation for ActiveModel::Lint

上级 4d4bdb07
......@@ -110,3 +110,10 @@ functionality from the following modules:
# => ["Name Can not be nil"]
{Learn more}[link:classes/ActiveModel/Errors.html]
* Testing the compliance of your object
User ActiveModel::Lint to test the compliance of your object to the
basic ActiveModel API...
{Learn more}[link:classes/ActiveModel/Lint/Tests.html]
......@@ -13,8 +13,7 @@
module ActiveModel
module Lint
module Tests
# valid?
# ------
# == Responds to <tt>valid?</tt>
#
# Returns a boolean that specifies whether the object is in a valid or invalid
# state.
......@@ -23,8 +22,7 @@ def test_valid?
assert_boolean model.valid?, "valid?"
end
# new_record?
# -----------
# == Responds to <tt>new_record?</tt>
#
# Returns a boolean that specifies whether the object has been persisted yet.
# This is used when calculating the URL for an object. If the object is
......@@ -41,8 +39,7 @@ def test_destroyed?
assert_boolean model.destroyed?, "destroyed?"
end
# naming
# ------
# == Naming
#
# Model.model_name must returns a string with some convenience methods as
# :human and :partial_path. Check ActiveModel::Naming for more information.
......@@ -55,9 +52,8 @@ def test_model_naming
assert_kind_of String, model_name.partial_path
end
# errors
# ------
#
# == Errors Testing
#
# Returns an object that has :[] and :full_messages defined on it. See below
# for more details.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册