aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/translation_test.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-02-27 21:14:11 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-27 21:23:52 -0200
commitacf0688fdd85a6d6ac278446e81f365239acc198 (patch)
tree2af35df0b99f7be419d7c237e55445699542051f /activemodel/test/cases/translation_test.rb
parent86ad8a6c877636b4df7966233dff7fea377b0790 (diff)
downloadrails-acf0688fdd85a6d6ac278446e81f365239acc198.tar.gz
rails-acf0688fdd85a6d6ac278446e81f365239acc198.tar.bz2
rails-acf0688fdd85a6d6ac278446e81f365239acc198.zip
failing test for i18n key collision with namespaced models
Diffstat (limited to 'activemodel/test/cases/translation_test.rb')
-rw-r--r--activemodel/test/cases/translation_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb
index c299d6eb5e..1b1d972d5c 100644
--- a/activemodel/test/cases/translation_test.rb
+++ b/activemodel/test/cases/translation_test.rb
@@ -49,6 +49,13 @@ class ActiveModelI18nTests < ActiveModel::TestCase
assert_equal 'person name attribute', Child.human_attribute_name('name')
end
+ def test_translated_model_attributes_with_attribute_matching_namespaced_model_name
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:gender => 'person gender'}, :"person/gender" => {:attribute => 'person gender attribute'}}}
+
+ assert_equal 'person gender', Person.human_attribute_name('gender')
+ assert_equal 'person gender attribute', Person::Gender.human_attribute_name('attribute')
+ end
+
def test_translated_model_names
I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }
assert_equal 'person model', Person.model_name.human