Sha256: 1b24ab74883f23c9deda88bace4274540d1525b3c5e7fff914d1afc3ba326f2b
Contents?: true
Size: 886 Bytes
Versions: 5
Compression:
Stored size: 886 Bytes
Contents
require 'rails/test_help' class ActiveSupport::TestCase setup do User.destroy_all Admin.destroy_all end end module MongoMapper module Validate class ValidationErrors # ActiveModel prepends field names in +#full_messages+, and so the # expected result of calling errors[field_name] will not include the # field name in the message. However, DM expects the field name to be # included in the original message. Assuming that the field name will # begin the message, just strip it out (plus the following space) for # testing purposes. This has no effect on #full_messages. # def [](property_name) # if property_errors = errors[property_name.to_sym] # property_errors.collect do |message| # message[(property_name.to_s.length + 1)..-1] # end # end # end end end end
Version data entries
5 entries across 5 versions & 1 rubygems