Sha256: d55bdfe8d66a8b64e23513a9316cee4d27dfbdbdd750c3344fcb003cb1cff9cc

Contents?: true

Size: 898 Bytes

Versions: 15

Compression:

Stored size: 898 Bytes

Contents

require 'rails/test_help'

DataMapper.auto_migrate!

class ActiveSupport::TestCase
  setup do
    User.all.destroy!
    Admin.all.destroy!
  end
end

module DataMapper
  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

15 entries across 15 versions & 1 rubygems

Version Path
dm-devise-1.4.0 test/orm/data_mapper.rb
dm-devise-1.3.1 test/orm/data_mapper.rb
dm-devise-1.3.0 test/orm/data_mapper.rb
dm-devise-1.2.0 test/orm/data_mapper.rb
dm-devise-1.2.0.rc test/orm/data_mapper.rb
dm-devise-1.1.8 test/orm/data_mapper.rb
dm-devise-1.2.0.beta test/orm/data_mapper.rb
dm-devise-1.1.6 test/orm/data_mapper.rb
dm-devise-1.1.5 test/orm/data_mapper.rb
dm-devise-1.1.4 test/orm/data_mapper.rb
dm-devise-1.1.3 test/orm/data_mapper.rb
dm-devise-1.1.2 test/orm/data_mapper.rb
dm-devise-1.1.1 test/orm/data_mapper.rb
dm-devise-1.1.0 test/orm/data_mapper.rb
dm-devise-0.1.0 test/orm/data_mapper.rb