From d8ba2f7c5670f5b2ef1486c9a3fb3e69fc514989 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Fri, 29 Mar 2019 21:38:48 +0530 Subject: Rename `i18n_full_message` config option to `i18n_customize_full_message` - I feel `i18n_customize_full_messages` explains the meaning of the config better. - Followup of https://github.com/rails/rails/pull/32956 --- activemodel/test/cases/railtie_test.rb | 10 ++++----- .../test/cases/validations/i18n_validation_test.rb | 26 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'activemodel/test/cases') diff --git a/activemodel/test/cases/railtie_test.rb b/activemodel/test/cases/railtie_test.rb index ab60285e2a..507135d4e4 100644 --- a/activemodel/test/cases/railtie_test.rb +++ b/activemodel/test/cases/railtie_test.rb @@ -35,20 +35,20 @@ class RailtieTest < ActiveModel::TestCase test "i18n full message defaults to false" do @app.initialize! - assert_equal false, ActiveModel::Errors.i18n_full_message + assert_equal false, ActiveModel::Errors.i18n_customize_full_message end test "i18n full message can be disabled" do - @app.config.active_model.i18n_full_message = false + @app.config.active_model.i18n_customize_full_message = false @app.initialize! - assert_equal false, ActiveModel::Errors.i18n_full_message + assert_equal false, ActiveModel::Errors.i18n_customize_full_message end test "i18n full message can be enabled" do - @app.config.active_model.i18n_full_message = true + @app.config.active_model.i18n_customize_full_message = true @app.initialize! - assert_equal true, ActiveModel::Errors.i18n_full_message + assert_equal true, ActiveModel::Errors.i18n_customize_full_message end end diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index ccb565c5bd..eb03e837f1 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -13,8 +13,8 @@ class I18nValidationTest < ActiveModel::TestCase I18n.backend = I18n::Backend::Simple.new I18n.backend.store_translations("en", errors: { messages: { custom: nil } }) - @original_i18n_full_message = ActiveModel::Errors.i18n_full_message - ActiveModel::Errors.i18n_full_message = true + @original_i18n_customize_full_message = ActiveModel::Errors.i18n_customize_full_message + ActiveModel::Errors.i18n_customize_full_message = true end def teardown @@ -22,7 +22,7 @@ class I18nValidationTest < ActiveModel::TestCase I18n.load_path.replace @old_load_path I18n.backend = @old_backend I18n.backend.reload! - ActiveModel::Errors.i18n_full_message = @original_i18n_full_message + ActiveModel::Errors.i18n_customize_full_message = @original_i18n_customize_full_message end def test_full_message_encoding @@ -47,7 +47,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_doesnt_use_attribute_format_without_config - ActiveModel::Errors.i18n_full_message = false + ActiveModel::Errors.i18n_customize_full_message = false I18n.backend.store_translations("en", activemodel: { errors: { models: { person: { attributes: { name: { format: "%{message}" } } } } } }) @@ -58,7 +58,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_uses_attribute_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { person: { attributes: { name: { format: "%{message}" } } } } } }) @@ -69,7 +69,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_uses_model_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { person: { format: "%{message}" } } } }) @@ -80,7 +80,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_uses_deeply_nested_model_attributes_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { 'person/contacts/addresses': { attributes: { street: { format: "%{message}" } } } } } }) @@ -91,7 +91,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_uses_deeply_nested_model_model_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { 'person/contacts/addresses': { format: "%{message}" } } } }) @@ -102,7 +102,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_with_indexed_deeply_nested_attributes_and_attributes_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { 'person/contacts/addresses': { attributes: { street: { format: "%{message}" } } } } } }) @@ -113,7 +113,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_with_indexed_deeply_nested_attributes_and_model_format - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { errors: { models: { 'person/contacts/addresses': { format: "%{message}" } } } }) @@ -124,7 +124,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_with_indexed_deeply_nested_attributes_and_i18n_attribute_name - ActiveModel::Errors.i18n_full_message = true + ActiveModel::Errors.i18n_customize_full_message = true I18n.backend.store_translations("en", activemodel: { attributes: { 'person/contacts/addresses': { country: "Country" } } @@ -136,7 +136,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_with_indexed_deeply_nested_attributes_without_i18n_config - ActiveModel::Errors.i18n_full_message = false + ActiveModel::Errors.i18n_customize_full_message = false I18n.backend.store_translations("en", activemodel: { errors: { models: { 'person/contacts/addresses': { attributes: { street: { format: "%{message}" } } } } } }) @@ -147,7 +147,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_errors_full_messages_with_i18n_attribute_name_without_i18n_config - ActiveModel::Errors.i18n_full_message = false + ActiveModel::Errors.i18n_customize_full_message = false I18n.backend.store_translations("en", activemodel: { attributes: { 'person/contacts[0]/addresses[0]': { country: "Country" } } -- cgit v1.2.3