diff options
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/validations_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb index 578ffc27dd..aa75b8b0d2 100644 --- a/activemodel/test/cases/validations_test.rb +++ b/activemodel/test/cases/validations_test.rb @@ -4,6 +4,7 @@ require 'cases/helper' require 'models/topic' require 'models/reply' require 'models/custom_reader' +require 'models/automobile' class ValidationsTest < ActiveModel::TestCase @@ -252,4 +253,16 @@ class ValidationsTest < ActiveModel::TestCase Topic.validates_length_of :title, :minimum => 10 assert_equal 10, Topic.validators_on(:title).first.options[:minimum] end + + def test_validations_on_the_instance_level + auto = Automobile.new + + assert auto.invalid? + assert_equal 2, auto.errors.size + + auto.make = 'Toyota' + auto.model = 'Corolla' + + assert auto.valid? + end end |