diff options
author | Ernie Miller <ernie@metautonomo.us> | 2010-10-04 15:04:39 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-04 21:26:42 +0200 |
commit | 21cb1d40b9c57ab814c69d01a242b50e27e8283b (patch) | |
tree | adf1136a6850e353327f448ca7e35e86534dc64e /activemodel | |
parent | 33aaa15f6208d65ca043ffcc5dc161d410963e9d (diff) | |
download | rails-21cb1d40b9c57ab814c69d01a242b50e27e8283b.tar.gz rails-21cb1d40b9c57ab814c69d01a242b50e27e8283b.tar.bz2 rails-21cb1d40b9c57ab814c69d01a242b50e27e8283b.zip |
Test to_model being called in ActiveModel::Naming helpers
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/test/cases/naming_test.rb | 4 | ||||
-rw-r--r-- | activemodel/test/models/track_back.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/activemodel/test/cases/naming_test.rb b/activemodel/test/cases/naming_test.rb index 40ce4c0e2d..a7dde2c433 100644 --- a/activemodel/test/cases/naming_test.rb +++ b/activemodel/test/cases/naming_test.rb @@ -125,6 +125,10 @@ class NamingHelpersTest < Test::Unit::TestCase @param_key = 'contact' end + def test_to_model_called_on_record + assert_equal 'post_named_track_backs', plural(Post::TrackBack.new) + end + def test_singular assert_equal @singular, singular(@record) end diff --git a/activemodel/test/models/track_back.rb b/activemodel/test/models/track_back.rb index d137e4ff8f..545acd1655 100644 --- a/activemodel/test/models/track_back.rb +++ b/activemodel/test/models/track_back.rb @@ -1,4 +1,11 @@ class Post class TrackBack + def to_model + NamedTrackBack.new(self) + end + end + + class NamedTrackBack + extend ActiveModel::Naming end end
\ No newline at end of file |