2022-01-01 13:38:12 +00:00
|
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
|
2018-09-11 09:21:09 +00:00
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do
|
|
|
|
|
before { Setting.set('ldap_config', config) }
|
|
|
|
|
|
|
|
|
|
context 'when LDAP config isn’t broken' do
|
|
|
|
|
let(:config) do
|
|
|
|
|
{ 'wizardData' =>
|
2018-12-19 17:31:51 +00:00
|
|
|
|
{ 'backend_user_attributes' =>
|
|
|
|
|
{ 'foo' => 'bar' },
|
|
|
|
|
'user_attributes' =>
|
|
|
|
|
{ 'baz' => 'qux' } } }.with_indifferent_access
|
2018-09-11 09:21:09 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'makes no changes' do
|
|
|
|
|
expect { migrate }.not_to change { Setting.get('ldap_config') }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2019-02-20 17:09:03 +00:00
|
|
|
|
context 'when LDAP config was assumed to be broken' do
|
2018-09-11 09:21:09 +00:00
|
|
|
|
let(:config) do
|
|
|
|
|
{ 'wizardData' =>
|
2018-12-19 17:31:51 +00:00
|
|
|
|
{ 'backend_user_attributes' =>
|
|
|
|
|
{ 'foo' => "\u0001\u0001\u0004€" },
|
|
|
|
|
'user_attributes' =>
|
|
|
|
|
{ 'baz' => 'qux' } } }.with_indifferent_access
|
2018-09-11 09:21:09 +00:00
|
|
|
|
end
|
|
|
|
|
|
2019-02-20 17:09:03 +00:00
|
|
|
|
it 'makes no changes' do
|
|
|
|
|
expect { migrate }.not_to change { Setting.get('ldap_config') }
|
2018-09-11 09:21:09 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|