Sha256: cdcf53ce73d1368cc5c8328c855650012016511d7def241c2b3038b58263fbcf

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'test_helper'

# See data_mapper_test.rb in this folder for what this file is doing.
if DEVISE_ORM == :data_mapper

  class ValidatableTest < ActiveSupport::TestCase
    undef test_should_require_a_password_with_minimum_of_6_characters

    # DataMapper uses a :value_between error message when given a minimum and
    # maximum; ActiveModel shows either the :too_long or :too_short message.
    test 'should require a password with minimum of 6 characters' do
      user = new_user(:password => '12345', :password_confirmation => '12345')
      assert user.invalid?
      # assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
      assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
    end

    undef test_should_require_a_password_with_maximum_of_128_characters_long

    # Same issue as previous test
    test 'should require a password with maximum of 128 characters long' do
      user = new_user(:password => 'x'*129, :password_confirmation => 'x'*129)
      assert user.invalid?
      # assert_equal 'is too long (maximum is 20 characters)', user.errors[:password].join
      assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-devise-1.3.1 test/overrides/dm_validations_test.rb