aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/secure_password_test.rb
diff options
context:
space:
mode:
authorYevhene Shemet <yevhene@gmail.com>2014-08-06 17:41:36 +0300
committerYevhene Shemet <yevhene@gmail.com>2014-08-06 22:11:06 +0300
commitf8dcb365dfb8506c60297a4434f70f41b5259250 (patch)
treed11691bec39ebeed383ad1993516616d475c8143 /activemodel/test/cases/secure_password_test.rb
parentd5be08347fb7ff758572775ec93247a3ca886004 (diff)
downloadrails-f8dcb365dfb8506c60297a4434f70f41b5259250.tar.gz
rails-f8dcb365dfb8506c60297a4434f70f41b5259250.tar.bz2
rails-f8dcb365dfb8506c60297a4434f70f41b5259250.zip
Allow password to contain spaces only.
Diffstat (limited to 'activemodel/test/cases/secure_password_test.rb')
-rw-r--r--activemodel/test/cases/secure_password_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activemodel/test/cases/secure_password_test.rb b/activemodel/test/cases/secure_password_test.rb
index 6b21bc68fa..6d56c8344a 100644
--- a/activemodel/test/cases/secure_password_test.rb
+++ b/activemodel/test/cases/secure_password_test.rb
@@ -40,6 +40,11 @@ class SecurePasswordTest < ActiveModel::TestCase
assert @user.valid?(:create), 'user should be valid'
end
+ test "create a new user with validation and a spaces only password" do
+ @user.password = ' ' * 72
+ assert @user.valid?(:create), 'user should be valid'
+ end
+
test "create a new user with validation and a blank password" do
@user.password = ''
assert !@user.valid?(:create), 'user should be invalid'
@@ -105,6 +110,11 @@ class SecurePasswordTest < ActiveModel::TestCase
assert @existing_user.valid?(:update), 'user should be valid'
end
+ test "updating an existing user with validation and a spaces only password" do
+ @user.password = ' ' * 72
+ assert @user.valid?(:update), 'user should be valid'
+ end
+
test "updating an existing user with validation and a blank password and password_confirmation" do
@existing_user.password = ''
@existing_user.password_confirmation = ''