diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-19 14:58:14 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-12-19 15:01:29 -0200 |
commit | 08ccd29b5b1e3badc2176a8036fea138b774c38f (patch) | |
tree | 9cda3f80b5cad5d6cb525dffcf38bc1c6de17e72 /activemodel/test | |
parent | 37e643120a5f4ba9fa15b74d6f489f7a0bb66c0d (diff) | |
download | rails-08ccd29b5b1e3badc2176a8036fea138b774c38f.tar.gz rails-08ccd29b5b1e3badc2176a8036fea138b774c38f.tar.bz2 rails-08ccd29b5b1e3badc2176a8036fea138b774c38f.zip |
Remove weak_passwords list and the length/strong password validator, leave that up to the programmer
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/secure_password_test.rb | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/activemodel/test/cases/secure_password_test.rb b/activemodel/test/cases/secure_password_test.rb index 2c3da2c93e..79be715730 100644 --- a/activemodel/test/cases/secure_password_test.rb +++ b/activemodel/test/cases/secure_password_test.rb @@ -4,33 +4,9 @@ require 'models/user' class SecurePasswordTest < ActiveModel::TestCase setup do - User.weak_passwords = %w( password qwerty 123456 ) @user = User.new end - test "there should be a list of default weak passwords" do - assert_equal %w( password qwerty 123456 ), User.weak_passwords - end - - test "specifying the list of passwords" do - User.weak_passwords = %w( pass ) - assert_equal %w( pass ), User.weak_passwords - end - - test "specifying the list of passwords in the class" do - User.send(:set_weak_passwords, ['pass']) - assert_equal %w( pass ), User.weak_passwords - end - - test "adding to the list of passwords" do - User.weak_passwords << 'pass' - @user.password = "password" - assert !@user.valid? - - @user.password = "pass" - assert !@user.valid? - end - test "password must be present" do assert !@user.valid? assert_equal 1, @user.errors.size @@ -47,34 +23,10 @@ class SecurePasswordTest < ActiveModel::TestCase assert @user.valid? end - test "password must pass validation rules" do - @user.password = "password" - assert !@user.valid? - - @user.password = "short" - assert !@user.valid? - - @user.password = "plentylongenough" - assert @user.valid? - end - - test "too weak passwords" do - @user.password = "012345" - assert !@user.valid? - assert_equal ["is too short (minimum is 7 characters)"], @user.errors[:password] - - @user.password = "password" - assert !@user.valid? - assert_equal ["is too weak and common"], @user.errors[:password] - - @user.password = "d9034rfjlakj34RR$!!" - assert @user.valid? - end - test "authenticate" do @user.password = "secret" assert !@user.authenticate("wrong") assert @user.authenticate("secret") end -end
\ No newline at end of file +end |