Browse files

Revert "Revert "Validators should at model level and not at AR:Base l…

…evel [Closes #4804]""

This reverts commit d675493.
  • Loading branch information...
1 parent 6865b5e commit a087bc85fd24e7261ce6a6f63ffa2dbd49db567d @wycats wycats committed Jun 12, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 activerecord/test/cases/validations_test.rb
View
10 activerecord/test/cases/validations_test.rb
@@ -9,6 +9,8 @@
require 'models/owner'
require 'models/pet'
require 'models/event'
+require 'models/parrot'
+require 'models/company'
class ProtectedPerson < ActiveRecord::Base
set_table_name 'people'
@@ -189,4 +191,12 @@ def test_validate_is_deprecated_on_update
end
assert_equal ["always invalid", "invalid on update"], p.errors[:name]
end
+
+ def test_validators
+ assert_equal 1, Parrot.validators.size
+ assert_equal 1, Company.validators.size
+ assert_equal 1, Parrot.validators_on(:name).size
+ assert_equal 1, Company.validators_on(:name).size
+ end
+
end

0 comments on commit a087bc8

Please sign in to comment.