trabajo-afectivo/spec/db/migrate/issue_2140_reset_ldap_config_spec.rb
2022-01-01 14:38:12 +01:00

35 lines
1.2 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require 'rails_helper'
RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do
before { Setting.set('ldap_config', config) }
context 'when LDAP config isnt broken' do
let(:config) do
{ 'wizardData' =>
{ 'backend_user_attributes' =>
{ 'foo' => 'bar' },
'user_attributes' =>
{ 'baz' => 'qux' } } }.with_indifferent_access
end
it 'makes no changes' do
expect { migrate }.not_to change { Setting.get('ldap_config') }
end
end
context 'when LDAP config was assumed to be broken' do
let(:config) do
{ 'wizardData' =>
{ 'backend_user_attributes' =>
{ 'foo' => "\u0001\u0001\u0004€" },
'user_attributes' =>
{ 'baz' => 'qux' } } }.with_indifferent_access
end
it 'makes no changes' do
expect { migrate }.not_to change { Setting.get('ldap_config') }
end
end
end