README.md in whyvalidationssuckin96-1.2.0 vs README.md in whyvalidationssuckin96-1.2.1
- old
+ new
@@ -41,11 +41,11 @@
pass
end
end
validates_presence_of :title, :artist
- validates_numericality_of :year
+ validates_numericality_of :year, :only_integer => true
end
end
Check instances of your class for validity and inspect the failed validations:
@@ -57,10 +57,14 @@
song.all_validations
Easily inspect and test for the presence of validations on your class:
Song.validation_collection.detect do |(klass, opts)|
- klass.is_a?(WhyValidationsSuckIn96::ValidatesPresence)
+ klass == WhyValidationsSuckIn96::ValidatesPresence
+ end
+
+ Song.validation_collection.detect do |(klass, opts)|
+ klass == WhyValidationsSuckIn96::ValidatesNumericality && opts[:only_integer]
end
Create your own reusable and testable validations:
require 'whyvalidationssuckin96/skippable_validation'