From edcca8cd3fa900caeb2e535716b5cc6d1f17f473 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 2 Sep 2011 13:14:15 -0400 Subject: [PATCH] DatabaseAuthenticatable#clean_up_passwords should set accessors to nil, not empty string. --- lib/devise/models/database_authenticatable.rb | 2 +- test/integration/authenticatable_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/devise/models/database_authenticatable.rb b/lib/devise/models/database_authenticatable.rb index b88aa453..033f84e7 100644 --- a/lib/devise/models/database_authenticatable.rb +++ b/lib/devise/models/database_authenticatable.rb @@ -45,7 +45,7 @@ module Devise # Set password and password confirmation to nil def clean_up_passwords - self.password = self.password_confirmation = "" + self.password = self.password_confirmation = nil end # Update record attributes when :current_password matches, otherwise returns diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index 8f5e73f9..8abc6d5f 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -401,14 +401,14 @@ class AuthenticationOthersTest < ActionController::IntegrationTest test 'sign in stub in xml format' do get new_user_session_path(:format => 'xml') - assert_equal "\n\n \n \n\n", response.body + assert_equal "\n\n \n \n\n", response.body end test 'sign in stub in json format' do get new_user_session_path(:format => 'json') assert_match '{"user":{', response.body assert_match '"email":""', response.body - assert_match '"password":""', response.body + assert_match '"password":null', response.body end test 'sign in stub in json with non attribute key' do @@ -416,7 +416,7 @@ class AuthenticationOthersTest < ActionController::IntegrationTest get new_user_session_path(:format => 'json') assert_match '{"user":{', response.body assert_match '"other_key":null', response.body - assert_match '"password":""', response.body + assert_match '"password":null', response.body end end