spec/validators/ssn_validator.rb in mongoid-rspec-1.8.2 vs spec/validators/ssn_validator.rb in mongoid-rspec-1.9.0
- old
+ new
@@ -1,8 +1,10 @@
class SsnValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
- record.errors[attribute] << "#{value} is not a valid Social Security Number" unless valid_ssn?(record, attribute, value)
+ unless valid_ssn?(record, attribute, value)
+ record.errors[attribute] << "#{value} is not a valid Social Security Number"
+ end
end
def self.kind() :custom end
def valid_ssn?(record, attribute, value)
\ No newline at end of file