diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-31 13:44:15 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-02 22:27:02 +0100 |
commit | 5fdd0e80a4db778268e80435b471090cb14f7229 (patch) | |
tree | 3331da25671e00d29ca86d4c24753da6b30031a3 /activemodel/test | |
parent | dcafe995bfe51e53dd04607956be9b54073e9cb6 (diff) | |
download | rails-5fdd0e80a4db778268e80435b471090cb14f7229.tar.gz rails-5fdd0e80a4db778268e80435b471090cb14f7229.tar.bz2 rails-5fdd0e80a4db778268e80435b471090cb14f7229.zip |
Be sure to convert namespaced names to we have 'Parrots name' instead of 'Parrots.name' in error messages.
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/validations/i18n_validation_test.rb | 2 | ||||
-rw-r--r-- | activemodel/test/cases/validations_test.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index 2717a09331..1cec15110e 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -57,7 +57,7 @@ class I18nValidationTest < ActiveModel::TestCase def test_errors_full_messages_translates_human_attribute_name_for_model_attributes @person.errors.add('name', 'empty') - I18n.expects(:translate).with(:"person.name", :default => ['Name'], :scope => [:activemodel, :attributes], :count => 1).returns('Name') + I18n.expects(:translate).with(:"person.name", :default => ['Name', 'Name'], :scope => [:activemodel, :attributes], :count => 1).returns('Name') @person.errors.full_messages end diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb index 61910395b5..38a2a716a7 100644 --- a/activemodel/test/cases/validations_test.rb +++ b/activemodel/test/cases/validations_test.rb @@ -71,6 +71,12 @@ class ValidationsTest < ActiveModel::TestCase assert_equal 2, r.errors.count end + def test_errors_on_nested_attributes_expands_name + t = Topic.new + t.errors["replies.name"] << "can't be blank" + assert_equal ["Replies name can't be blank"], t.errors.full_messages + end + def test_errors_on_base r = Reply.new r.content = "Mismatch" |