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:
parent
a8d88d193e
commit
c3432e57b1
2 changed files with 13 additions and 0 deletions
|
@ -120,6 +120,15 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||||
assert_match "can't be blank", user.errors[:current_password].join
|
assert_match "can't be blank", user.errors[:current_password].join
|
||||||
end
|
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
|
test 'should ignore password and its confirmation if they are blank' do
|
||||||
user = create_user
|
user = create_user
|
||||||
assert user.update_with_password(:current_password => '123456', :email => "new@example.com")
|
assert user.update_with_password(:current_password => '123456', :email => "new@example.com")
|
||||||
|
|
|
@ -10,6 +10,10 @@ class WithValidation < Admin
|
||||||
devise :database_authenticatable, :validatable, :password_length => 2..6
|
devise :database_authenticatable, :validatable, :password_length => 2..6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class UserWithValidation < User
|
||||||
|
validates_presence_of :username
|
||||||
|
end
|
||||||
|
|
||||||
class Several < Admin
|
class Several < Admin
|
||||||
devise :validatable
|
devise :validatable
|
||||||
devise :lockable
|
devise :lockable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue