mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Some minor fixes
This commit is contained in:
parent
b6ddbfb158
commit
98705d88cd
2 changed files with 2 additions and 3 deletions
|
@ -60,12 +60,12 @@ module ActiveModel
|
||||||
# This ensures the model has a password by checking whether the password_digest
|
# This ensures the model has a password by checking whether the password_digest
|
||||||
# is present, so that this works with both new and existing records. However,
|
# is present, so that this works with both new and existing records. However,
|
||||||
# when there is an error, the message is added to the password attribute instead
|
# when there is an error, the message is added to the password attribute instead
|
||||||
# so that the error message will makes sense to the end-user.
|
# so that the error message will make sense to the end-user.
|
||||||
validate do |record|
|
validate do |record|
|
||||||
record.errors.add(:password, :blank) unless record.password_digest.present?
|
record.errors.add(:password, :blank) unless record.password_digest.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
validates_confirmation_of :password, if: ->{ self.password.present? }
|
validates_confirmation_of :password, if: ->{ password.present? }
|
||||||
end
|
end
|
||||||
|
|
||||||
if respond_to?(:attributes_protected_by_default)
|
if respond_to?(:attributes_protected_by_default)
|
||||||
|
|
|
@ -2,7 +2,6 @@ require 'cases/helper'
|
||||||
require 'models/user'
|
require 'models/user'
|
||||||
require 'models/visitor'
|
require 'models/visitor'
|
||||||
|
|
||||||
require 'active_support/all'
|
|
||||||
class SecurePasswordTest < ActiveModel::TestCase
|
class SecurePasswordTest < ActiveModel::TestCase
|
||||||
setup do
|
setup do
|
||||||
ActiveModel::SecurePassword.min_cost = true
|
ActiveModel::SecurePassword.min_cost = true
|
||||||
|
|
Loading…
Reference in a new issue