From 0c6f2adf14b6d86961d2389faf8f54334078b4bf Mon Sep 17 00:00:00 2001 From: Drew Ulmer Date: Sat, 1 Dec 2012 21:06:11 -0600 Subject: [PATCH] Add failing test for #2129 --- test/models/database_authenticatable_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/models/database_authenticatable_test.rb b/test/models/database_authenticatable_test.rb index c184fcb4..0986be07 100644 --- a/test/models/database_authenticatable_test.rb +++ b/test/models/database_authenticatable_test.rb @@ -13,6 +13,21 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase assert_equal email.downcase, user.email end + test 'should downcase case insensitive keys that refer to virtual attributes when saving' do + email = 'Foo@Bar1.com' + confirmation = 'Foo@Bar1.com' + pw = '12345678' + user = UserWithVirtualAttributes.new( + :email => email, + :email_confirmation => confirmation, + :password => pw, + :password_confirmation => pw) + + assert_nothing_raised "ActiveRecord::RecordInvalid" do + user.save! + end + 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 '