diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-30 13:07:48 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-30 13:12:12 +0100 |
commit | d6e2f5013cdc0aa830d167a84582f48dc636dc81 (patch) | |
tree | ff2f5726ad2a452a768fc551571ed3e09a80d1e6 /activemodel/test/cases | |
parent | 431fc3c81735f8873e52f4a1942a5ac761d18cc9 (diff) | |
download | rails-d6e2f5013cdc0aa830d167a84582f48dc636dc81.tar.gz rails-d6e2f5013cdc0aa830d167a84582f48dc636dc81.tar.bz2 rails-d6e2f5013cdc0aa830d167a84582f48dc636dc81.zip |
Drop AR I18n deprecation and simple use errors.messages as fallback.
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/validations/i18n_validation_test.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index 7d33fcea98..38844bb1fa 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -254,7 +254,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_confirmation_of w/o mocha def test_validates_confirmation_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:confirmation => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:confirmation => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:confirmation => 'global message'}} Person.validates_confirmation_of :title @@ -275,7 +275,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_acceptance_of w/o mocha def test_validates_acceptance_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:accepted => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:accepted => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:accepted => 'global message'}} Person.validates_acceptance_of :title, :allow_nil => false @@ -294,7 +294,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_presence_of w/o mocha def test_validates_presence_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:blank => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:blank => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:blank => 'global message'}} Person.validates_presence_of :title @@ -313,7 +313,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_length_of :within w/o mocha def test_validates_length_of_within_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:too_short => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:too_short => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:too_short => 'global message'}} Person.validates_length_of :title, :within => 3..5 @@ -332,7 +332,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_length_of :is w/o mocha def test_validates_length_of_is_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:wrong_length => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:wrong_length => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:wrong_length => 'global message'}} Person.validates_length_of :title, :is => 5 @@ -351,7 +351,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_format_of w/o mocha def test_validates_format_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:invalid => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:invalid => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:invalid => 'global message'}} Person.validates_format_of :title, :with => /^[1-9][0-9]*$/ @@ -370,7 +370,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_inclusion_of w/o mocha def test_validates_inclusion_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:inclusion => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:inclusion => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:inclusion => 'global message'}} Person.validates_inclusion_of :title, :in => %w(a b c) @@ -389,7 +389,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_exclusion_of w/o mocha def test_validates_exclusion_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:exclusion => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:exclusion => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:exclusion => 'global message'}} Person.validates_exclusion_of :title, :in => %w(a b c) @@ -410,7 +410,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_numericality_of without :only_integer w/o mocha def test_validates_numericality_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:not_a_number => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:not_a_number => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:not_a_number => 'global message'}} Person.validates_numericality_of :title @@ -431,7 +431,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_numericality_of with :only_integer w/o mocha def test_validates_numericality_of_only_integer_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:not_a_number => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:not_a_number => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:not_a_number => 'global message'}} Person.validates_numericality_of :title, :only_integer => true @@ -452,7 +452,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_numericality_of :odd w/o mocha def test_validates_numericality_of_odd_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:odd => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:odd => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:odd => 'global message'}} Person.validates_numericality_of :title, :only_integer => true, :odd => true @@ -473,7 +473,7 @@ class I18nValidationTest < ActiveModel::TestCase # validates_numericality_of :less_than w/o mocha def test_validates_numericality_of_less_than_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:less_than => 'custom message'}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:less_than => 'custom message'}}}}}} I18n.backend.store_translations 'en', :errors => {:messages => {:less_than => 'global message'}} Person.validates_numericality_of :title, :only_integer => true, :less_than => 0 @@ -502,7 +502,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_validates_with_message_symbol_must_translate_per_attribute - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:attributes => {:title => {:custom_error => "I am a custom error"}}}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:attributes => {:title => {:custom_error => "I am a custom error"}}}}}} Person.validates_presence_of :title, :message => :custom_error @person.title = nil @person.valid? @@ -510,7 +510,7 @@ class I18nValidationTest < ActiveModel::TestCase end def test_validates_with_message_symbol_must_translate_per_model - I18n.backend.store_translations 'en', :errors => {:models => {:person => {:custom_error => "I am a custom error"}}} + I18n.backend.store_translations 'en', :activemodel => {:errors => {:models => {:person => {:custom_error => "I am a custom error"}}}} Person.validates_presence_of :title, :message => :custom_error @person.title = nil @person.valid? |