aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
diff options
context:
space:
mode:
authorSamuel Kadolph <samuel@kadolph.com>2010-12-09 13:30:02 -0500
committerVijay Dev <vijaydev.cse@gmail.com>2010-12-16 01:49:28 +0530
commit972011a2e58be5caf84bf06dd954ba095c823984 (patch)
tree2018a74e10fd1737a4ef2057c99d6c4b1b189742 /activemodel/test/cases
parent0dc39cd8ee24466f204a292ae61643ce3b3b4c32 (diff)
downloadrails-972011a2e58be5caf84bf06dd954ba095c823984.tar.gz
rails-972011a2e58be5caf84bf06dd954ba095c823984.tar.bz2
rails-972011a2e58be5caf84bf06dd954ba095c823984.zip
Add support for namespaced validators
Includes test and documentation for new feature Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r--activemodel/test/cases/validations/validates_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations/validates_test.rb b/activemodel/test/cases/validations/validates_test.rb
index 666c48c8a0..3a9900939e 100644
--- a/activemodel/test/cases/validations/validates_test.rb
+++ b/activemodel/test/cases/validations/validates_test.rb
@@ -3,6 +3,7 @@ require 'cases/helper'
require 'models/person'
require 'models/person_with_validator'
require 'validators/email_validator'
+require 'validators/namespace/email_validator'
class ValidatesTest < ActiveModel::TestCase
setup :reset_callbacks
@@ -34,6 +35,13 @@ class ValidatesTest < ActiveModel::TestCase
assert_equal ['is not an email'], person.errors[:karma]
end
+ def test_validates_with_namespaced_validator_class
+ Person.validates :karma, :'namespace/email' => true
+ person = Person.new
+ person.valid?
+ assert_equal ['is not an email'], person.errors[:karma]
+ end
+
def test_validates_with_if_as_local_conditions
Person.validates :karma, :presence => true, :email => { :unless => :condition_is_true }
person = Person.new