diff options
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/validations/exclusion_validation_test.rb | 10 | ||||
-rw-r--r-- | activemodel/test/cases/validations/inclusion_validation_test.rb | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations/exclusion_validation_test.rb b/activemodel/test/cases/validations/exclusion_validation_test.rb index fe0d13ec33..e1807a3f34 100644 --- a/activemodel/test/cases/validations/exclusion_validation_test.rb +++ b/activemodel/test/cases/validations/exclusion_validation_test.rb @@ -63,4 +63,14 @@ class ExclusionValidationTest < ActiveModel::TestCase p.author_name = "sikachu" assert_raise(ArgumentError){ p.valid? } end + + def test_validates_inclusion_with_explicit_include + range = (1..100) + Topic.validates_exclusion_of :title, :in => range, :use_include => true + range.expects(:include?).returns(false) + + t = Topic.new + t.title = 102 + assert t.valid? + end end diff --git a/activemodel/test/cases/validations/inclusion_validation_test.rb b/activemodel/test/cases/validations/inclusion_validation_test.rb index e6adb6d187..d183b42c2b 100644 --- a/activemodel/test/cases/validations/inclusion_validation_test.rb +++ b/activemodel/test/cases/validations/inclusion_validation_test.rb @@ -95,4 +95,13 @@ class InclusionValidationTest < ActiveModel::TestCase p.author_name = "sikachu" assert_raise(ArgumentError){ p.valid? } end + + def test_validates_inclusion_with_explicit_include + range = (1..100) + Topic.validates_inclusion_of :title, :in => range, :use_include => true + + t = Topic.new + t.title = 42 + assert t.valid? + end end |