diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-08 19:52:26 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-08 19:53:16 +0100 |
commit | 7280787a53436046e992305a235e66e4fb458e0f (patch) | |
tree | 43dc2c9511e1b159ff055aa9e1cf624c4843f303 /activemodel/test | |
parent | 3cae753963f4c7b6c676a20c407a56bb8d98712a (diff) | |
download | rails-7280787a53436046e992305a235e66e4fb458e0f.tar.gz rails-7280787a53436046e992305a235e66e4fb458e0f.tar.bz2 rails-7280787a53436046e992305a235e66e4fb458e0f.zip |
Improve cache on route_key lookup.
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/naming_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/test/cases/naming_test.rb b/activemodel/test/cases/naming_test.rb index b2976ab1fb..acda989eec 100644 --- a/activemodel/test/cases/naming_test.rb +++ b/activemodel/test/cases/naming_test.rb @@ -217,6 +217,7 @@ class NamingHelpersTest < Test::Unit::TestCase @singular = 'contact' @plural = 'contacts' @uncountable = Sheep + @singular_route_key = 'contact' @route_key = 'contacts' @param_key = 'contact' end @@ -243,10 +244,12 @@ class NamingHelpersTest < Test::Unit::TestCase def test_route_key assert_equal @route_key, route_key(@record) + assert_equal @singular_route_key, singular_route_key(@record) end def test_route_key_for_class assert_equal @route_key, route_key(@klass) + assert_equal @singular_route_key, singular_route_key(@klass) end def test_param_key @@ -262,6 +265,11 @@ class NamingHelpersTest < Test::Unit::TestCase assert !uncountable?(@klass), "Expected 'contact' to be countable" end + def test_uncountable_route_key + assert_equal "sheep", singular_route_key(@uncountable) + assert_equal "sheep_index", route_key(@uncountable) + end + private def method_missing(method, *args) ActiveModel::Naming.send(method, *args) |