Permalink
Browse files

Raise ArgumentError when no attribute is given to AMo::EachValidator

ArgumentError is better suited than RuntimeError for this.
  • Loading branch information...
carlosantoniodasilva committed Nov 4, 2012
1 parent d9f20c5 commit b1fe78e0cb81d6d291b982927353c4fa39d8e269
@@ -135,7 +135,7 @@ class EachValidator < Validator #:nodoc:
# and instead be made available through the +attributes+ reader.
def initialize(options)
@attributes = Array(options.delete(:attributes))
- raise ":attributes cannot be blank" if @attributes.empty?
+ raise ArgumentError, ":attributes cannot be blank" if @attributes.empty?
super
check_validity!
end
@@ -151,7 +151,7 @@ def check_validity!
end
test "each validator expects attributes to be given" do
- assert_raise RuntimeError do
+ assert_raise ArgumentError do
Topic.validates_with(ValidatorPerEachAttribute)
end
end

0 comments on commit b1fe78e

Please sign in to comment.