Browse files

Added validates_numericality_of

  • Loading branch information...
1 parent cfda850 commit da0d81734d38dc5f11e42e24d12f0e96e347f5ba @postpostmodern postpostmodern committed Sep 8, 2008
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/spec/rails/matchers/validations.rb
View
7 lib/spec/rails/matchers/validations.rb
@@ -8,6 +8,13 @@ def validate_presence_of(attribute)
end
end
+ def validate_numericality_of(attribute)
+ return simple_matcher("validate the numericality of #{attribute}") do |model|
+ model.send("#{attribute}=", 'foo')
+ !model.valid? && model.errors.invalid?(attribute)
+ end
+ end
+
def validate_length_of(attribute, options)
if options.has_key? :within
min = options[:within].first

0 comments on commit da0d817

Please sign in to comment.