Maintenance: Gem dependency psych update causes encoding issue to be fixed. Changed test case to ensure special unicode chars are handled properly.

This commit is contained in:
Thorsten Eckel 2019-02-20 18:09:03 +01:00 committed by Martin Edenhofer
parent 0fe24ab1b7
commit a679c713a8
2 changed files with 6 additions and 5 deletions

View file

@ -1,3 +1,6 @@
# ATTENTION: This migration is most likely not required anymore
# because the encoding error was fixed by using a newer version of the psych gem (3.1.0).
# However, we'll keep it as a regression test.
class Issue2140ResetLdapConfig < ActiveRecord::Migration[5.1] class Issue2140ResetLdapConfig < ActiveRecord::Migration[5.1]
def up def up
# return if it's a new setup # return if it's a new setup

View file

@ -17,7 +17,7 @@ RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do
end end
end end
context 'when LDAP config is broken' do context 'when LDAP config was assumed to be broken' do
let(:config) do let(:config) do
{ 'wizardData' => { 'wizardData' =>
{ 'backend_user_attributes' => { 'backend_user_attributes' =>
@ -26,10 +26,8 @@ RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do
{ 'baz' => 'qux' } } }.with_indifferent_access { 'baz' => 'qux' } } }.with_indifferent_access
end end
it 'removes the offending backend_user_attributes sub-hash' do it 'makes no changes' do
expect { migrate } expect { migrate }.not_to change { Setting.get('ldap_config') }
.to change { Setting.get('ldap_config') }
.to(config.tap { |c| c[:wizardData].delete(:backend_user_attributes) })
end end
end end
end end