From 653fa4c10c3e4a34cfe0fe93a2612ed178ca4455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 31 Dec 2009 14:19:30 +0100 Subject: Add naming to AMo::Lint --- activemodel/lib/active_model/lint.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/lint.rb b/activemodel/lib/active_model/lint.rb index 1c2347adbf..0be82aa180 100644 --- a/activemodel/lib/active_model/lint.rb +++ b/activemodel/lib/active_model/lint.rb @@ -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 # ------ # -- cgit v1.2.3