mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Test to_model being called in ActiveModel::Naming helpers
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
33aaa15f62
commit
21cb1d40b9
2 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class Post
|
||||
class TrackBack
|
||||
def to_model
|
||||
NamedTrackBack.new(self)
|
||||
end
|
||||
end
|
||||
|
||||
class NamedTrackBack
|
||||
extend ActiveModel::Naming
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue