]> source.dussan.org Git - redmine.git/commitdiff
add test of validate password length at unit user test
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 21 Sep 2011 06:13:16 +0000 (06:13 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 21 Sep 2011 06:13:16 +0000 (06:13 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7430 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/user_test.rb

index 1d982241e48b2ffb11287753880d6f4f80c6a4f4..9a3ca6bc39f45c3799a36166082352daba4f63e4 100644 (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