1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Test for previous commit

This commit is contained in:
Chase DuBois 2011-06-21 20:45:07 -04:00
parent a8d88d193e
commit c3432e57b1
2 changed files with 13 additions and 0 deletions

View file

@ -120,6 +120,15 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
assert_match "can't be blank", user.errors[:current_password].join
end
test 'should run validations even when current password is invalid or blank' do
user = UserWithValidation.create!(valid_attributes)
user.save
assert user.persisted?
assert_not user.update_with_password(:username => "")
assert_match "usertest", user.reload.username
assert_match "can't be blank", user.errors[:username].join
end
test 'should ignore password and its confirmation if they are blank' do
user = create_user
assert user.update_with_password(:current_password => '123456', :email => "new@example.com")

View file

@ -10,6 +10,10 @@ class WithValidation < Admin
devise :database_authenticatable, :validatable, :password_length => 2..6
end
class UserWithValidation < User
validates_presence_of :username
end
class Several < Admin
devise :validatable
devise :lockable