Project

General

Profile

Actions

Defect #37449

closed

Passing a wrong parameter to `with_settings` in UserTest::test_random_password_include_required_characters

Added by Go MAEDA over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Setting.password_required_char_classes stores an array like ["uppercase", "lowercase", "digits"] but UserTest::test_random_password_include_required_characters passes a hash.

diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index dde1cdd62..53e7693ff 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -1099,7 +1099,7 @@ class UserTest < ActiveSupport::TestCase
   end

   def test_random_password_include_required_characters
-    with_settings :password_required_char_classes => Setting::PASSWORD_CHAR_CLASSES do
+    with_settings :password_required_char_classes => Setting::PASSWORD_CHAR_CLASSES.keys do
       u = User.new(:firstname => "new", :lastname => "user", :login => "random", :mail => "random@somnet.foo")
       u.random_password
       assert u.valid?

Related issues

Related to Redmine - Feature #4221: Force passwords to contain specified character classesClosedGo MAEDA2009-11-16

Actions
Actions

Also available in: Atom PDF