issue_2140_reset_ldap_config_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. require 'rails_helper'
  2. RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do
  3. before { Setting.set('ldap_config', config) }
  4. context 'when LDAP config isn’t broken' do
  5. let(:config) do
  6. { 'wizardData' =>
  7. { 'backend_user_attributes' =>
  8. { 'foo' => 'bar' },
  9. 'user_attributes' =>
  10. { 'baz' => 'qux' } } }.with_indifferent_access
  11. end
  12. it 'makes no changes' do
  13. expect { migrate }.not_to change { Setting.get('ldap_config') }
  14. end
  15. end
  16. context 'when LDAP config was assumed to be broken' do
  17. let(:config) do
  18. { 'wizardData' =>
  19. { 'backend_user_attributes' =>
  20. { 'foo' => "\u0001\u0001\u0004€" },
  21. 'user_attributes' =>
  22. { 'baz' => 'qux' } } }.with_indifferent_access
  23. end
  24. it 'makes no changes' do
  25. expect { migrate }.not_to change { Setting.get('ldap_config') }
  26. end
  27. end
  28. end