1
0
Fork 0
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:
Stefan Wrobel 2011-06-10 01:37:43 -07:00
parent 4964f53a42
commit 8e87a2d80d
8 changed files with 81 additions and 1 deletions

View file

@ -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