1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Set the new default for strip_whitespace_keys config

This commit is contained in:
Ulisses Almeida 2016-04-26 15:36:15 -03:00
parent fdd9337b64
commit 93df02f601
2 changed files with 4 additions and 18 deletions

View file

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

View file

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