提交 a5b03e9c 编写于 作者: F Franck Verrot 提交者: Santiago Pastorino

Implement and test private method all_timestamp_attributes_in_model

Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 47315760
......@@ -74,6 +74,10 @@ def timestamp_attributes_for_update_in_model
timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
end
def all_timestamp_attributes_in_model
timestamp_attributes_for_create_in_model + timestamp_attributes_for_update_in_model
end
def timestamp_attributes_for_update #:nodoc:
[:updated_at, :updated_on]
end
......
......@@ -165,4 +165,9 @@ def test_timestamp_attributes_for_update_in_model
toy = Toy.first
assert_equal toy.send(:timestamp_attributes_for_update_in_model), [:updated_at]
end
def test_all_timestamp_attributes_in_model
toy = Toy.first
assert_equal toy.send(:all_timestamp_attributes_in_model), [:created_at, :updated_at]
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册