From 27fed66f494f94169d8e5d4ecd48897b11047131 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Fri, 18 Feb 2011 15:56:33 +0100 Subject: [PATCH] failing test for i18n key collision with namespaced models --- activemodel/test/cases/translation_test.rb | 7 +++++++ activemodel/test/models/person.rb | 3 +++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb index c299d6e..6279709 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 attribute'}}} + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:gender => {:description => 'person/gender description attribute'}}}} + + assert_equal 'person gender attribute', Person.human_attribute_name(:gender) + end + def test_translated_model_names I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} } assert_equal 'person model', Person.model_name.human diff --git a/activemodel/test/models/person.rb b/activemodel/test/models/person.rb index eb84f7a..3b9c1a8 100644 --- a/activemodel/test/models/person.rb +++ b/activemodel/test/models/person.rb @@ -9,6 +9,9 @@ class Person end end +class Person::Gender +end + class Child < Person end -- 1.7.3.2