issue_3245_office_365_microsoft_rename_spec.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue3245Office365MicrosoftRename, type: :db_migration do
  4. it 'renames Office 365 to Microsoft' do
  5. replace_setting_with_old
  6. migrate
  7. new_setting = Setting.find_by(name: 'auth_microsoft_office365')
  8. expect(new_setting.preferences).to include(title_i18n: ['Microsoft'], description_i18n: ['Microsoft', 'Microsoft Application Registration Portal', 'https://portal.azure.com'])
  9. end
  10. def replace_setting_with_old
  11. Setting
  12. .find_by(name: 'auth_microsoft_office365')
  13. .destroy!
  14. Setting.create!(
  15. title: 'Authentication via %s',
  16. name: 'auth_microsoft_office365',
  17. area: 'Security::ThirdPartyAuthentication',
  18. description: 'Enables user authentication via %s. Register your app first at [%s](%s).',
  19. options: {
  20. form: [
  21. {
  22. display: '',
  23. null: true,
  24. name: 'auth_microsoft_office365',
  25. tag: 'boolean',
  26. options: {
  27. true => 'yes',
  28. false => 'no',
  29. },
  30. },
  31. ],
  32. },
  33. preferences: {
  34. controller: 'SettingsAreaSwitch',
  35. sub: ['auth_microsoft_office365_credentials'],
  36. title_i18n: ['Microsoft'],
  37. description_i18n: ['Microsoft', 'Microsoft Application Registration Portal', 'https://portal.azure.com'],
  38. permission: ['admin.security'],
  39. },
  40. state: false,
  41. frontend: true
  42. )
  43. end
  44. end