aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/translation_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/test/cases/translation_test.rb')
-rw-r--r--activemodel/test/cases/translation_test.rb36
1 files changed, 15 insertions, 21 deletions
diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb
index d171784963..bfc1ca12e6 100644
--- a/activemodel/test/cases/translation_test.rb
+++ b/activemodel/test/cases/translation_test.rb
@@ -1,11 +1,5 @@
require 'cases/helper'
-
-class SuperUser
- extend ActiveModel::Translation
-end
-
-class User < SuperUser
-end
+require 'models/person'
class ActiveModelI18nTests < ActiveModel::TestCase
@@ -14,38 +8,38 @@ class ActiveModelI18nTests < ActiveModel::TestCase
end
def test_translated_model_attributes
- I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } }
- assert_equal 'super_user name attribute', SuperUser.human_attribute_name('name')
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:name => 'person name attribute'} } }
+ assert_equal 'person name attribute', Person.human_attribute_name('name')
end
def test_translated_model_attributes_with_symbols
- I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } }
- assert_equal 'super_user name attribute', SuperUser.human_attribute_name(:name)
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:name => 'person name attribute'} } }
+ assert_equal 'person name attribute', Person.human_attribute_name(:name)
end
def test_translated_model_attributes_with_ancestor
- I18n.backend.store_translations 'en', :activemodel => {:attributes => {:user => {:name => 'user name attribute'} } }
- assert_equal 'user name attribute', User.human_attribute_name('name')
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:child => {:name => 'child name attribute'} } }
+ assert_equal 'child name attribute', Child.human_attribute_name('name')
end
def test_translated_model_attributes_with_ancestors_fallback
- I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } }
- assert_equal 'super_user name attribute', User.human_attribute_name('name')
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:name => 'person name attribute'} } }
+ assert_equal 'person name attribute', Child.human_attribute_name('name')
end
def test_translated_model_names
- I18n.backend.store_translations 'en', :activemodel => {:models => {:super_user => 'super_user model'} }
- assert_equal 'super_user model', SuperUser.model_name.human
+ I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }
+ assert_equal 'person model', Person.model_name.human
end
def test_translated_model_names_with_sti
- I18n.backend.store_translations 'en', :activemodel => {:models => {:user => 'user model'} }
- assert_equal 'user model', User.model_name.human
+ I18n.backend.store_translations 'en', :activemodel => {:models => {:child => 'child model'} }
+ assert_equal 'child model', Child.model_name.human
end
def test_translated_model_names_with_ancestors_fallback
- I18n.backend.store_translations 'en', :activemodel => {:models => {:super_user => 'super_user model'} }
- assert_equal 'super_user model', User.model_name.human
+ I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }
+ assert_equal 'person model', Child.model_name.human
end
end