diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-22 16:53:46 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-22 16:53:46 -0200 |
commit | 78adc4529a0447a685be59534c1e627a0a1077d0 (patch) | |
tree | ad377d3589fa3177014d6b78b8edcd7628fecff2 | |
parent | 8059b82cbf141867cfb3a0a0fc6f1cc7ecdae1e7 (diff) | |
download | rails-78adc4529a0447a685be59534c1e627a0a1077d0.tar.gz rails-78adc4529a0447a685be59534c1e627a0a1077d0.tar.bz2 rails-78adc4529a0447a685be59534c1e627a0a1077d0.zip |
Add tests to make sure that the I18n taken message can be overrided in the
activerecord scope.
Related with 5341b84936d93ec90e6252af437a3871101c115a
-rw-r--r-- | activerecord/test/cases/validations/i18n_generate_message_validation_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb index 174d96aa4e..32d2bf746f 100644 --- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb @@ -59,4 +59,18 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') end + test "translation for 'taken' can be overridden in activerecord scope" do + I18n.backend.store_translations "en", {activerecord: {errors: {messages: {taken: "Custom taken message" }}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end + + test "translation for 'taken' can be overridden in activerecord model scope" do + I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {taken: "Custom taken message" }}}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end + + test "translation for 'taken' can be overridden in activerecord attributes scope" do + I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {attributes: {title: {taken: "Custom taken message" }}}}}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end end |