From 93df02f6014fcdd4bae90ae07d8d5ea63717a30e Mon Sep 17 00:00:00 2001 From: Ulisses Almeida Date: Tue, 26 Apr 2016 15:36:15 -0300 Subject: [PATCH] Set the new default for strip_whitespace_keys config --- lib/devise.rb | 16 ++-------------- test/devise_test.rb | 6 ++---- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/devise.rb b/lib/devise.rb index 9ac71a75..dae7bda6 100755 --- a/lib/devise.rb +++ b/lib/devise.rb @@ -88,19 +88,8 @@ module Devise @@case_insensitive_keys = [:email] # Keys that should have whitespace stripped. - # TODO: 4.1 Do: @@strip_whitespace_keys = [:email] - mattr_reader :strip_whitespace_keys - @@strip_whitespace_keys = [] - - def self.strip_whitespace_keys=(strip_whitespace_keys) - app_set_configs << :strip_whitespace_keys - @@strip_whitespace_keys = strip_whitespace_keys - end - - def strip_whitespace_keys=(strip_whitespace_keys) - app_set_configs << :strip_whitespace_keys - @@strip_whitespace_keys = strip_whitespace_keys - end + mattr_accessor :strip_whitespace_keys + @@strip_whitespace_keys = [:email] # If http authentication is enabled by default. mattr_accessor :http_authenticatable @@ -333,7 +322,6 @@ module Devise warn_default_config_changed(:reconfirmable, 'false', 'true') warn_default_config_changed(:sign_out_via, ':get', ':delete') warn_default_config_changed(:skip_session_storage, '[]', '[:http_auth]') - warn_default_config_changed(:strip_whitespace_keys, '[]', '[:email]') end def self.warn_default_config_changed(config, current_default, new_default) diff --git a/test/devise_test.rb b/test/devise_test.rb index 1392dc63..fe75a45a 100755 --- a/test/devise_test.rb +++ b/test/devise_test.rb @@ -37,11 +37,10 @@ class DeviseTest < ActiveSupport::TestCase test 'setup block warns about defaults changing' do Devise.app_set_configs = Set.new - + ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /reconfirmable/ } ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /sign_out_via/ } ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /skip_session_storage/ } - ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /strip_whitespace_keys/ } Devise.setup do end @@ -53,8 +52,7 @@ class DeviseTest < ActiveSupport::TestCase swap Devise, reconfirmable: false, sign_out_via: :get, - skip_session_storage: [], - strip_whitespace_keys: [] do + skip_session_storage: [] do Devise.setup do end end