Methods
- S
- T
-
- teardown,
- test_human_attribute_name_does_not_modify_options,
- test_human_does_not_modify_options,
- test_translated_deeply_nested_model_attributes,
- test_translated_model_attributes,
- test_translated_model_attributes_falling_back_to_default,
- test_translated_model_attributes_using_default_option,
- test_translated_model_attributes_using_default_option_as_symbol,
- test_translated_model_attributes_using_default_option_as_symbol_and_falling_back_to_default,
- test_translated_model_attributes_with_ancestor,
- test_translated_model_attributes_with_ancestors_fallback,
- test_translated_model_attributes_with_attribute_matching_namespaced_model_name,
- test_translated_model_attributes_with_default,
- test_translated_model_attributes_with_symbols,
- test_translated_model_names,
- test_translated_model_names_with_ancestors_fallback,
- test_translated_model_names_with_sti,
- test_translated_model_with_namespace,
- test_translated_nested_model_attributes,
- test_translated_nested_model_attributes_with_namespace_fallback
Instance Public methods
setup()
Link
teardown()
Link
test_human_attribute_name_does_not_modify_options()
Link
test_human_does_not_modify_options()
Link
test_translated_deeply_nested_model_attributes()
Link
# File activemodel/test/cases/translation_test.rb, line 66 def test_translated_deeply_nested_model_attributes I18n.backend.store_translations 'en', activemodel: { attributes: { :"person/contacts/addresses" => { street: 'Deeply Nested Address Street' } } } assert_equal 'Deeply Nested Address Street', Person.human_attribute_name('contacts.addresses.street') end
test_translated_model_attributes()
Link
# File activemodel/test/cases/translation_test.rb, line 14 def test_translated_model_attributes I18n.backend.store_translations 'en', activemodel: { attributes: { person: { name: 'person name attribute' } } } assert_equal 'person name attribute', Person.human_attribute_name('name') end
test_translated_model_attributes_falling_back_to_default()
Link
test_translated_model_attributes_using_default_option()
Link
test_translated_model_attributes_using_default_option_as_symbol()
Link
# File activemodel/test/cases/translation_test.rb, line 28 def test_translated_model_attributes_using_default_option_as_symbol I18n.backend.store_translations 'en', default_name: 'name default attribute' assert_equal 'name default attribute', Person.human_attribute_name('name', default: :default_name) end
test_translated_model_attributes_using_default_option_as_symbol_and_falling_back_to_default()
Link
test_translated_model_attributes_with_ancestor()
Link
# File activemodel/test/cases/translation_test.rb, line 46 def test_translated_model_attributes_with_ancestor I18n.backend.store_translations 'en', activemodel: { attributes: { child: { name: 'child name attribute'} } } assert_equal 'child name attribute', Child.human_attribute_name('name') end
test_translated_model_attributes_with_ancestors_fallback()
Link
# File activemodel/test/cases/translation_test.rb, line 51 def test_translated_model_attributes_with_ancestors_fallback I18n.backend.store_translations 'en', activemodel: { attributes: { person: { name: 'person name attribute'} } } assert_equal 'person name attribute', Child.human_attribute_name('name') end
test_translated_model_attributes_with_attribute_matching_namespaced_model_name()
Link
# File activemodel/test/cases/translation_test.rb, line 56 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
test_translated_model_attributes_with_default()
Link
test_translated_model_attributes_with_symbols()
Link
# File activemodel/test/cases/translation_test.rb, line 41 def test_translated_model_attributes_with_symbols I18n.backend.store_translations 'en', activemodel: { attributes: { person: { name: 'person name attribute'} } } assert_equal 'person name attribute', Person.human_attribute_name(:name) end
test_translated_model_names()
Link
test_translated_model_names_with_ancestors_fallback()
Link
test_translated_model_names_with_sti()
Link
test_translated_model_with_namespace()
Link
test_translated_nested_model_attributes()
Link
# File activemodel/test/cases/translation_test.rb, line 71 def test_translated_nested_model_attributes I18n.backend.store_translations 'en', activemodel: { attributes: { :"person/addresses" => { street: 'Person Address Street' } } } assert_equal 'Person Address Street', Person.human_attribute_name('addresses.street') end
test_translated_nested_model_attributes_with_namespace_fallback()
Link
# File activemodel/test/cases/translation_test.rb, line 76 def test_translated_nested_model_attributes_with_namespace_fallback I18n.backend.store_translations 'en', activemodel: { attributes: { addresses: { street: 'Cool Address Street' } } } assert_equal 'Cool Address Street', Person.human_attribute_name('addresses.street') end