add test of validate password length at unit user test

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7430 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-21 06:13:16 +00:00
parent 97c7e84f49
commit 80581538a1
1 changed files with 10 additions and 0 deletions

View File

@ -370,6 +370,16 @@ class UserTest < ActiveSupport::TestCase
assert_equal "admin", user.login
end
def test_validate_password_length
with_settings :password_min_length => '100' do
user = User.new(:firstname => "new100", :lastname => "user100", :mail => "newuser100@somenet.foo")
user.login = "newuser100"
user.password, user.password_confirmation = "password100", "password100"
assert !user.save
assert_equal 1, user.errors.count
end
end
def test_name_format
assert_equal 'Smith, John', @jsmith.name(:lastname_coma_firstname)
Setting.user_format = :firstname_lastname