mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Add strip_whitespace_keys which works like case_insensitive_keys but strips whitespace from emails
This commit is contained in:
parent
4964f53a42
commit
8e87a2d80d
8 changed files with 81 additions and 1 deletions
|
|
@ -11,6 +11,16 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
|||
user.save!
|
||||
assert_equal email.downcase, user.email
|
||||
end
|
||||
|
||||
test 'should remove whitespace from strip whitespace keys when saving' do
|
||||
# strip_whitespace_keys is set to :email by default.
|
||||
email = ' foo@bar.com '
|
||||
user = new_user(:email => email)
|
||||
|
||||
assert_equal email, user.email
|
||||
user.save!
|
||||
assert_equal email.strip, user.email
|
||||
end
|
||||
|
||||
test 'find_for_authentication and filter_auth_params should not modify the conditions hash' do
|
||||
FilterAuthUser = Class.new(User) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue